<?php include("includes/db_config.php");
if (isset($_POST['submit'])) {
 //var_dump($_FILES);exit();
extract($_POST);
date_default_timezone_set('Asia/Kolkata');
$datetime = date('Y-m-d H:i:s');
$sql="INSERT into ah_party(type,party_name,date_of_joining,email_id,party_phone_no,billing_address,gst_type,gst_no,gst_state,opening_balance,as_of_date,paying_status) values ('Purchase','$party_name','$date_of_joining','$email_id','$party_phone_no','$billing_address','$gst_type','$gst_no','$gst_state','$opening_balance','$as_of_date','$paying_status')";
 if  (mysqli_query($conn, $sql)){
     echo "<script>location.replace('all-vendor.php');</script>";
 }
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr" data-theme="light">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <?php include("includes/css.php");?>
</head>

<body class="preload-active aside-active aside-mobile-minimized aside-desktop-maximized">
    <div class="holder">
        <?php include("includes/sidebar.php");?>
        <div class="wrapper">
            <?php include("includes/header.php");?>
            <div class="content">
                <div class="container-fluid g-5">
                    <div class="row">
                        <div class="col-12">
                            <div class="portlet">
                                <div class="portlet-header portlet-header-bordered">
                                    <h3 class="portlet-title">Add New Vendor</h3>
                                </div>
                                <div class="portlet-body">
                                    <form class="row g-3" action="" method="post">
                                        <div class="mb-3 col-md-6">
                                            <label class="form-label">Vendor Name</label>
                                            <input type="text" name="party_name" placeholder="Enter Vendor Name" class="form-control">
                                        </div>
                                        <div class="mb-3 col-md-6">
                                            <label class="form-label">Date Of Joining</label>
                                            <input type="date" name="date_of_joining" value="" class="form-control">
                                        </div>
                                        <div class="mb-3 col-md-6">
                                            <label class="form-label">Email</label>
                                            <input type="email" name="email_id" value="admin@gmail.com" class="form-control">
                                        </div>
                                        <div class="mb-3 col-md-6">
                                            <label class="form-label">Vendor Phone Number</label>
                                            <input type="tel" name="party_phone_no" placeholder="Party Phone Number" class="form-control">
                                        </div>
                                        <div class="card">
                                            <div class="card-header">
                                                <div class="nav nav-lines card-header-lines" id="card1-tab" role="tablist">
                                                    <a class="nav-item nav-link active" id="card1-address-tab" data-bs-toggle="tab" href="#card1-address" aria-selected="true" role="tab">Address</a>
                                                    <a class="nav-item nav-link" id="card1-gst-tab" data-bs-toggle="tab" href="#card1-gst" aria-selected="false" role="tab" tabindex="-1">GST</a>
                                                    <a class="nav-item nav-link" id="card1-opb-tab" data-bs-toggle="tab" href="#card1-opb" aria-selected="false" tabindex="-1" role="tab">Opening Balance</a>
                                                </div>
                                            </div>
                                            <div class="card-body">
                                                <div class="tab-content">
                                                    <div class="tab-pane fade active show" id="card1-address" role="tabpanel" aria-labelledby="#card1-address-tab">
                                                        <div class="row">
                                                            <div class="col-md-12 mb-3">
                                                                <label class="form-label">Billing Address</label>
                                                                <textarea type="text" name="billing_address" rows="4" placeholder="Billing Address" class="form-control"></textarea>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="tab-pane fade" id="card1-gst" role="tabpanel" aria-labelledby="#card1-gst-tab">
                                                        <div class="row">
                                                            <div class="mb-3 col-md-6">
                                                                <label class="form-label">GST Type</label>
                                                                <select name="gst_type" type="text" class="form-control">
                                                                    <option>Select GST Type</option>
                                                                    <option>Unregistered/Consumer</option>
                                                                    <option>Registered Business - Regular</option>
                                                                    <option>Registered Business - Composition</option>
                                                                </select>
                                                            </div>
                                                            <div class="mb-3 col-md-6">
                                                                <label class="form-label">GST Number</label>
                                                                <input type="text" name="gst_no" placeholder="GST Number" class="form-control">
                                                            </div>
                                                            <div class="mb-3 col-md-6">
                                                                <label class="form-label">State</label>
                                                                <select type="text" name="gst_state" class="form-control">
                                                                    <option>Select State</option>
                                                                    <option>Andra Pradesh</option>
                                                                    <option>Telangana</option>
                                                                    <option>Other</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="tab-pane fade" id="card1-opb" role="tabpanel" aria-labelledby="#card1-opb-tab">
                                                        <div class="row">
                                                            <div class="mb-3 col-md-6">
                                                                <label class="form-label">Opening Balance</label>
                                                                <input type="text" name="opening_balance" placeholder="" class="form-control">
                                                            </div>
                                                            <div class="mb-3 col-md-6">
                                                                <label class="form-label">As Of Date</label>
                                                                <input type="text" name="as_of_date" class="form-control">
                                                            </div>
                                                            <div class="mb-3 col-md-2">
                                                                <div class="form-check">
                                                                    <input class="form-check-input" value="Pay" type="radio" name="paying_status" id="" checked="checked"> <label class="form-check-label" for="flexRadioDefault2">To Pay</label>
                                                                </div>
                                                            </div>
                                                            <div class="mb-3 col-md-3">
                                                                <div class="form-check"> <input class="form-check-input" type="radio" value="Recieve" name="paying_status"> <label class="form-check-label" for="flexRadioDefault2">To Recieve</label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-4"><button type="submit" name="submit" class="btn btn-primary btn-lg">Submit</button></div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php include("includes/footer.php");?>
        </div>
    </div>
    <?php include("includes/js.php");?>
</body>

</html>