<!DOCTYPE html>
<html>

<head>
    <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"> -->
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link href="css/ionicons.css" media="all" rel="stylesheet" type="text/css">
    <!-- <link rel="stylesheet" type="text/css" href="css/index.css"> -->
    <link rel="stylesheet" type="text/css" href="css/font-awesome.css">
    <link rel="stylesheet" type="text/css" href="css/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">

    <!--<script type="text/javascript" src="cordova.js"></script>-->
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>

    <script type="text/javascript" src="js/functions.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {


            $('.main-container').on('change', '#mode', function(evt) {

                var mode = $('#mode :selected').val();

                if(mode == 'resubmit'){
                    $('.re_s').show();
                    $('.re_n').hide();
                }else{
                    $('.re_s').hide();
                    $('.re_n').show();
                }
            });


            $('.main-container').on('click', '.contact-button', function(evt) {
                evt.preventDefault();

                var name = $('input[name="name"]').val();
                var email = $('input[name="email"]').val();
                var phone = $('input[name="phone"]').val();
                var address = $('input[name="address"]').val();
                var mode = $('#mode :selected').val();
                var service_charge = document.getElementById('payamount').innerHTML;


                var pin = $('input[name="pin"]').val();
                var attachment1 = $('#attachment1')[0].files[0];
                var attachment2 = $('#attachment2')[0].files[0];
                var attachment3 = $('#attachment3')[0].files[0];
                var attachment4 = $('#attachment4')[0].files[0];
                var attachment5 = $('#attachment5')[0].files[0];
                var attachment6 = $('#attachment6')[0].files[0];
                var attachment7 = $('#attachment7')[0].files[0];
                var attachment8 = $('#attachment8')[0].files[0];
                var productcode = localStorage.product_secial_code;

                var local = JSON.parse(localStorage['userDetails'].toString());
                var username = local.username;
                console.log("hehe")
                // console.log(mode);return;


                let formdata = new FormData();
                formdata.append("attachment1", attachment1);

                formdata.append("attachment2", attachment2);
                formdata.append("attachment3", attachment3);
                formdata.append("attachment4", attachment4);
                formdata.append("attachment5", attachment5);
                formdata.append("attachment6", attachment6);
                formdata.append("attachment7", attachment7);
                formdata.append("attachment8", attachment8);
                formdata.append("address", address);
                formdata.append("phone", phone);
                formdata.append("email", email);
                formdata.append("name", name);
                formdata.append("username", username);
                formdata.append("sc", service_charge);
                formdata.append("productcode", productcode);

                var contactUrl = base + "/appcode/otherForm.php";
                
                
                 if (localStorage.product_secial_code == 674) {
                    panCardList(base + '/appcode/pan_correction.php?mobileNumber='+phone+'&amount='+service_charge+'&mode='+mode+'&wp='+username);
                    return;
                }


                if (localStorage.product_secial_code == '292') {
                    
                    window.open(base + '/appcode/rechargepan.php?mobileNumber='+phone+'&amount='+service_charge+'&mode='+mode+'&wp='+username);

                    // panCardList(base + '/appcode/rechargepan.php?mobileNumber='+phone+'&amount='+service_charge+'&mode='+mode+'&wp='+username);

                    // panCardList(base + '/appcode/rechargepan.php?mobileNumber='+phone+'&amount='+service_charge+'&mode='+mode+'&wp='+username);

                    // $.ajax({

                    //     url: base + '/appcode/rechargepan.php',
                    //     dataType: 'json',
                    //     data: {
                    //         mobileNumber: phone,
                    //         amount: service_charge
                    //     },
                    //     success: function(response) {
                    //         console.log("response pan");
                    //         console.log(response);
                    //         let v = JSON.parse(response);
                    //         if (v.status == "Failure") {
                    //             alert("Action Fail Try Again");
                    //         } else {
                    //             alert("payment succesfull ");
                    //             $.ajax({
                    //                 url: contactUrl,
                    //                 type: "POST",
                    //                 data: formdata,
                    //                 dataType: "JSON",
                    //                 processData: false,
                    //                 contentType: false,
                    //                 success: function(response) {
                    //                     alert(response);
                    //                     console.log(response);
                    //                 },
                    //                 error: function(response) {

                    //                         alert("error");
                    //                     }
                                        
                    //             });
                    //         }

                    //     },
                    //     error: function(res) {
                    //         console.log("error");
                    //         console.log(res);
                    //     },
                    // });
                } else {
                    $.ajax({
                        url: contactUrl,
                        type: "POST",
                        data: formdata,
                        dataType: "JSON",
                        processData: false,
                        contentType: false,
                        success: function(response) {
                            alert("we'll contact you soon !");
                            console.log("111")
                            console.log(response);
                        },
                        error: function(response) {

                                alert("error");
                            }
                            // complete: function() {
                            //   alert(
                            //     'Message Sent Successfully,We will contact you soon!! Thank You.'
                            //   );
                            // window.location.href = "index.html";
                            //   }
                    });
                }

            });

            var data = '';


            $.ajax({
                url: base + '/appcode/fetch_admin_number.php',

                type: 'post',
                dataType: 'json',

                success: function(response) {

                    console.log(response);
                    //alert(response.value[0].phone)
                    data += '<p style="text-align:center; color:#fff;">You can contact us at <a href="tel:' + response.value[0].phone + '">' + response.value[0].phone + '</a> & <a href="mailto:' + response.value[0].E_Mail + '">' + response.value[0].E_Mail + ' </a> for any enquiry.</p>';

                    $('#number').append(data);
                },
                error: function(response) {
                    console.log(response);
                },
                complete: function() {
                    $('.supreme-container').hide();
                }
            });

            var data22 = 0;
            $.ajax({
                url: base + '/appcode/fetch_attachment.php',
                data: {
                    code: localStorage.product_secial_code
                },
                type: 'post',
                dataType: 'json',
                success: function(res) {
                    console.log("fetch_categories_tree")

                    // data2 +=`<div class="col s12" style="background: #E5F4F9;color:black;margin-bottom:15px;">
                    // 	<h5>Other</h5>
                    // </div>`;
                    $.each(res.categories, function(index, item) {
                        console.log("hehe");
                        document.getElementById('payamount').innerHTML = item[0].service_charge;
                        if (item[0].attachment1 != "") {

                            document.getElementById('img1').innerHTML = item[0].attachment1;


                        } else {
                            $(".img1").hide();
                        }

                        if(item[0].id == 292){
                            $('.mode').show();
                            $('.pan_hi').hide();
                        }

                        if (item[0].attachment2 != "") {

                            document.getElementById('img2').innerHTML = item[0].attachment2;

                        } else {
                            $(".img2").hide();
                        }
                        if (item[0].attachment3 != "") {
                            document.getElementById('img3').innerHTML = item[0].attachment3;
                        } else {
                            $(".img3").hide();
                        }
                        if (item[0].attachment4 != "") {
                            document.getElementById('img4').innerHTML = item[0].attachment4;
                        } else {
                            $(".img4").hide();
                        }
                        if (item[0].attachment5 != "") {
                            document.getElementById('img5').innerHTML = item[0].attachment5;
                        } else {
                            $(".img5").hide();
                        }
                        if (item[0].attachment6 != "") {
                            document.getElementById('img6').innerHTML = item[0].attachment6;
                        } else {
                            $(".img6").hide();
                        }
                        if (item[0].attachment7 != "") {
                            document.getElementById('img7').innerHTML = item[0].attachment7;
                        } else {
                            $(".img7").hide();
                        }
                        if (item[0].attachment8 != "") {
                            document.getElementById('img8').innerHTML = item[0].attachment8;
                        } else {
                            $(".img8").hide();
                        }
                        console.log("hhehh");

                    });
                    console.log(data22);
                    // $('.other-items').empty().append(data2);
                }
            });

        });
    </script>

</head>

<body>



    <header class="header pink-bg black-text z-depth-1">
        <div class="navbar">
            <button class="pink-bg navigation button-collapse" onclick="goBack()">
        <i class="ion-android-arrow-back"></i>
      </button>

            <h5 style=""></h5>

            <button class="pink-bg navigation go-to-cart">
            <i class="ion pink-bg"></i>
          </button>
        </div>
    </header>

    <div class="main-container" id="main-container" style="    padding-top: 15px;">
        <div class="" style="height:auto;">
            <h2 class="contact-heading"></h2>


            <div class="input-field pan_hi">
                <label for="name">Name:</label>
                <input id="name" type="text" name="name" class="validate">

            </div>

            <div class="input-field pan_hi">
                <input id="email" type="text" name="email" class="validate">
                <label for="email">Email:</label>
            </div>
            <div class="input-field pan_hi1 mode">
                <input id="phone" type="text" name="phone" class="validate">
                <label for="phone">Mobile:</label>
            </div>
            <div class="input-field pan_hi">
                <label for="address">Address</label>
                <input id="address" type="text" name="address" class="validate">

            </div>

            <div class="input-field mode" style="display: none;">
                <p style="color: #9e9e9e;">mode:</p>
                <select id="mode">
                  <option value="EKYC">PAN without signature</option>
                  <option value="ESIGN">PAN with signature and photo</option>
                  <option value="resubmit">Re-Submit</option>
                  
                </select>
          
            </div>

            <div class="input-field img1">
                <label for="attachment1" id="img1">Img1</label><br><br>
                <input id="attachment1" type="file" name="attachment1" class="validate">
            </div>
            <div class="input-field img2">
                <label for="attachment2" id="img2">Img2</label><br><br>
                <input id="attachment2" type="file" name="attachment2" class="validate">
            </div>
            <div class="input-field img3">
                <label for="attachment3" id="img3">Img3</label><br><br>
                <input id="attachment3" type="file" name="attachment3" class="validate">
            </div>
            <div class="input-field img4">
                <label for="attachment4" id="img4">Img4</label><br><br>
                <input id="attachment4" type="file" name="attachment4" class="validate">
            </div>
            <div class="input-field img5">
                <label for="attachment5" id="img5">Img5</label><br><br>
                <input id="attachment5" type="file" name="attachment5" class="validate">
            </div>
            <div class="input-field img6">
                <label for="attachment6" id="img6">Img6</label><br><br>
                <input id="attachment6" type="file" name="attachment6" class="validate">
            </div>
            <div class="input-field img7">
                <label for="attachment7" id="img7">Img7</label><br><br>
                <input id="attachment7" type="file" name="attachment7" class="validate">
            </div>
            <div class="input-field img8">
                <label for="attachment8" id="img8">Img8</label><br><br>
                <input id="attachment8" type="file" name="attachment8" class="validate">
            </div>

            <!-- <div class="input-field">
            <p style="color: #9e9e9e;">Complaint Type:</p>
            <select id="type">
              <option value="type 1">Type 1</option>
              <option value="type 2">Type 2</option>
              <option value="type 3">Type 3</option>
            </select>
      
          </div> -->

            <br>
            <button class="contact-button waves-effect waves-blue btn re_s" name="send-button" style="display: none;">RESUBMIT</button>

            <button class="contact-button waves-effect waves-blue btn re_n" name="send-button">Pay Rs. <b id="payamount" style="color:rgb(233, 6, 6);"></b> & Submit</button>
            <!-- </form> -->
        </div>
    </div>

    <p style="text-align: center; color:white"></p>
    </div>
    </div>


    <script type="text/javascript" src="js/materialize.min.js"></script>
    <script type="text/javascript" src="js/myfunctions.js"></script>
    <script type="text/javascript" src="js/jR3DCarousel.min.js"></script>



    <script type="text/javascript">
        //    $(document).ready(function () {
        //      var slideImages = [{src: 'http://www.dakshithtechnologies.com/DT/images/1.jpg'},
        //        {src: 'http://www.dakshithtechnologies.com/DT/images/2.jpg'},
        //        {src: 'http://www.dakshithtechnologies.com/DT/images/3.jpg'}];
        //      //var jR3DCarousel;
        //
        //      jR3DCarousel = $('.jR3DCarouselGallery').jR3DCarousel({
        //        width: 410, /* largest allowed width */
        //        height: 200, /* largest allowed height */
        //        slides: slideImages /* array of images source */
        //      });
        //    })
    </script>
    <script>
        $(document).ready(function() {

            let isLogin = checkLogin();
            if (isLogin) {
                if (localStorage.memberp == "Y") {

                    var pro = JSON.parse(localStorage['userDetails'].toString());

                    document.getElementById('name').value = pro.name;

                    // document.getElementById('address').innerHTML = pro.address;
                    document.getElementById('email').value = pro.email;
                    document.getElementById('phone').value = pro.phone;
                    document.getElementById('address').value = pro.address;


                    // document.getElementById('altphone').innerHTML = pro.altphone;
                    // document.getElementById('city').innerHTML = pro.city;

                } else {
                    alert("To access services need to become member of Star");
                    window.location.href = 'premium_plan_details.html';
                }
            } else {
                window.location.href = "login.html";
            }
        });

        function goBack() {
            window.history.back();
        }
    </script>
    <script type="text/javascript" src="js/materialize.min.js"></script>
    <script type="text/javascript" src="js/myfunctions.js"></script>
</body>

</html>