<?php
require_once './classes/classses.php';

$cf = new CenterFunction();
$branchs= $cf->all_branch();
$campuses= $cf->all_campus();



?>
           <div class="container-fluid">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="card tab2-card">
                                <div class="card-body">
                                    <ul class="nav nav-tabs tab-coupon" id="myTab" role="tablist">
                                        <li class="nav-item"><a class="nav-link active show" id="account-tab"
                                                data-bs-toggle="tab" href="#account" role="tab" aria-controls="account"
                                                aria-selected="true" data-original-title="" title="">Account</a></li>
                 
                                    </ul>

                                    <form action="#" name="add_lead" id="add_lead">
                                    <div class="tab-content" id="myTabContent">
                                        <div class="tab-pane fade active show" id="account" role="tabpanel"
                                            aria-labelledby="account-tab">
                                            <form class="needs-validation user-add" novalidate="">
                                                <h4>Account Details</h4>

                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Campus <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="campus" name="campus">
                                                        <?php

                                                        foreach($campuses as $campus)
                                                        {
                                                            echo "<option value='".$campus['campus_id']."'>".$campus['campus_name']."</option>";
                                                        }

                                                        ?>

                                                        </select>
                                                    </div>
                                                </div>


                                                
                                               <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Branch <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="branch" name="branch">
                                                          <?php

                                                            foreach($branchs as $branch)
                                                            {
                                                                echo "<option value='".$branch['branch_id']."'>".$branch['branch_name']."</option>";
                                                            }

                                                            ?>

                                                        </select>
                                                    </div>
                                                </div>


                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Preffer Language <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="lang" name="lang">
                                                          <option value="EN">English</option>
                                                          <option value="SI">සිංහල</option>
                                                          <option value="TA">தமிழ்</option>
                                                        </select>
                                                    </div>
                                                </div>


                                                <hr>

                                                <div class="form-group row">
                                                    <label for="validationCustom0"
                                                        class="col-xl-3 col-md-4">First Name <span>*</span> </label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <input class="form-control" id="fname" type="text" required="" name='fname' >
                                                    </div>
                                                </div>
                                                <div class="form-group row">
                                                    <label for="validationCustom1"
                                                        class="col-xl-3 col-md-4">Last Name<span>*</span> </label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <input class="form-control" id="lname" name="lname" type="text" required="">
                                                    </div>
                                                </div>
                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4"><span></span> Email (Optional)</label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <input class="form-control" id="email" name="email" type="text" required="">
                                                    </div>
                                                </div>
                                                

                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Contact 1<span>*</span></label>
                                                    <div class="col-xl-8 col-md-8">
                                                        <input class="form-control" id="contact1" name="contact1" type="tel" required="">
                                                    </div>
                                                </div>


                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Contact 2<span>*</span></label>
                                                    <div class="col-xl-8 col-md-8">
                                                        <input class="form-control" id="contact2" name="contact2" type="tel"
                                                            required="">
                                                    </div>
                                                </div>

                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Address<span>*</span></label>
                                                    <div class="col-xl-8 col-md-8">
                                                        <input class="form-control" id="address" name="address" type="tel"  required="">
                                                    </div>
                                                </div>

                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Course <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="course" name="course">
                                                          <option value="course1">Course 1</option>
                                                          <option value="course2">Course 2</option>
                                                          <option value="course3">Course 3</option>
                                                          <option value="course4">Course 4</option>
                                                          <option value="course5">Course 5</option>
                                                        </select>
                                                    </div>
                                                </div>


                                               <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Counselor <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="counselor" name="counselor">
                                                          <option value="counsellor1">Counsellor 1</option>
                                                          <option value="counsellor2">Counsellor 2</option>
                                                          <option value="counsellor3">Counsellor 3</option>
                                                          <option value="counsellor4">Counsellor 4</option>
                                                          <option value="counsellor5">Counsellor 5</option>
                                                        </select>
                                                    </div>
                                                </div>



                                                <div class="form-group row">
                                                    <label for="validationCustom2"
                                                        class="col-xl-3 col-md-4">Lead Source <span>*</span></label>
                                                    <div class="col-xl-8 col-md-7">
                                                        <select class="form-control" id="source" name="source">
                                                          <option value="WA">Whatsapp </option>
                                                          <option value="FB">Facebook</option>
                                                          <option value="IN">Instagram</option>
                                                          <option value="TK">Tiktok</option>
                                                          <option value="DC">Direct Call</option>
                                                          <option value="OT">Other</option>
                                                        </select>
                                                    </div>
                                                </div>


                                                

                                            </form>
                                        </div>

                                        <p id='addresp' name='addresp'></p>
                                        <p id="err-msg" style="color: red;"></p>
                              
                                    <div class="pull-right">
                                        <button name='addlead' id='addlead' type="submit" class="btn btn-primary">Add This Lead</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
