<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$maindb = 'visamain';
$trandb = 'visatran';
$formname = "Passport Status";
//$action = "register_fr.php";
$file = "pastatus.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);

$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
<!--<script src="MyScript/item.js" type="text/javascript"></script>-->
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>-->
<script>
    $(document).ready(function () {
        $("body").on("blur keyup", '.passport', getDates);
        function getDates() {
            var passport = $(".passport").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "get_medstatus.php",
                data: {passport: passport},
                success: function (response) {
                    var m = response;
                    $(".passrecd").val(m.passrecd);
                    $(".meddate").val(m.meddate);
                    $(".fitdate").val(m.fitdate);
                    $(".mofa_date").val(m.mofa_date);
                    $(".stampdate").val(m.stampdate);
                    $(".paxname").val(m.paxname);
                    $(".broker").val(m.broker);
                    $(".mofano").val(m.mofano);
                    $(".visano").val(m.visano);
                    $(".delvstatus").val(m.delvstatus);
                    $(".issplace").val(m.issplace);
                    $(".issdate").val(m.issdate);
                    $(".doe").val(m.doe);
                    $(".passdeliver").val(m.passdeliver);
                    if (m.passrecd != '0000-00-00' && m.passrecd != 'null') {
                        $(".passrecd").css("color", "blue");
                    } else {
                        $(".passrecd").css("color", "black");
                    }

                    if (m.meddate != '0000-00-00' && m.meddate != 'null') {
                        $(".meddate").css("color", "blue");
                    } else {
                        $(".meddate").css("color", "black");
                    }

                    if (m.fitdate != '0000-00-00' && m.fitdate != 'null') {
                        $(".fitdate").css("color", "blue");
                    } else {
                        $(".fitdate").css("color", "black");
                    }

                    if (m.mofa_date != '0000-00-00' && m.mofa_date != 'null') {
                        $(".mofa_date").css("color", "blue");
                    } else {
                        $(".mofa_date").css("color", "black");
                    }

                    if (m.stampdate != '0000-00-00' && m.stampdate != 'null') {
                        $(".stampdate").css("color", "blue");
                    } else {
                        $(".stampdate").css("color", "black");
                    }
                    
                    if (m.issdate != '0000-00-00' && m.issdate != 'null') {
                        $(".issdate").css("color", "blue");
                    } else {
                        $(".issdate").css("color", "black");
                    }
                    
                    if (m.doe != '0000-00-00' && m.doe != 'null') {
                        $(".doe").css("color", "blue");
                    } else {
                        $(".doe").css("color", "black");
                    }
                    
                    if (m.passdeliver != '0000-00-00' && m.passdeliver != 'null') {
                        $(".passdeliver").css("color", "blue");
                    } else {
                        $(".passdeliver").css("color", "black");
                    }

                    if (m.delvstatus == 'E') {
                        $(".delvstatus").val("ECR");
                    } else if (m.delvstatus == 'N') {
                        $(".delvstatus").val("ECNR");
                    } else {
                        $(".delvstatus").val("");
                    }

                },
                error: function (request, textStatus, errorThrown) {
                },
            });
        }
    });</script>



</head>
<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div>
            <div class="col-lg-6 col-md-6 col-sm-5 col-xs-12  pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php Echo $formname; ?></h3>
                        <div class="actions pull-right">
                            <i class="fa fa-chevron-down"></i>
                            <i class="fa fa-times"></i>
                        </div>
                    </div>
                    <div id="Div2" class="panel-body">

                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right   pad">
                                <label class="label-control marg">Passport Number</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad ">
                                <input type="text" name="passport" class="form-control passport" >
                            </div>
                        </div>
                        <!--<hr>-->

                        <!--***********************************************-->
                        <div id="myDIV">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                    <label class="control-label marg">Received Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8  pad">
                                    <input type="date" size="80" name="passrecd" value=""class="form-control form passrecd"/>
                                </div>
                            </div>
                            <!-- <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg">Medical Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8  pad">
                                    <input type="date" size="80" name="meddate" value=""class="form-control form meddate" />
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg">Fit Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8  pad">
                                    <input type="date" size="80" name="fitdate" value=""class="form-control form fitdate"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg">Mofa Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8  pad">
                                    <input type="date" size="80" name="mofa_date" value=""class="form-control form mofa_date"/>
                                </div>
                            </div> -->
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Stamp Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" size="80" name="stampdate" value="" class="form-control form stampdate"/>
                                </div>
                            </div>
                            <div class="row">
                                <hr>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Pax Name</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="paxname" value=""class="form-control form paxname"/>
                                </div>
                            </div>
                            <!-- <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Agent</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="broker" value=""class="form-control form broker"/>
                                </div>
                            </div> -->
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Mofa No.</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="mofano" value=""class="form-control form mofano"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Visa No.</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="visano" value=""class="form-control form visano"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Emigration Status</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="delvstatus" value=""class="form-control form delvstatus"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">POI</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="text" name="issplace" value=""class="form-control form issplace"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">DOI</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" size="80" name="issdate" value=""class="form-control form issdate"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">DOE</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" size="80" name="doe" value=""class="form-control form doe"/>
                                </div>
                            </div>
                            <!-- <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right  pad">
                                    <label class="control-label marg ">Release Date</label>
                                </div>
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-8 pad">
                                    <input type="date" size="80" name="passdeliver" value="" class="form-control form passdeliver"/>
                                </div>
                            </div> -->
                            <br>
                            <div class="panel-footer">
                                <?php include("includes/but_rep.php"); ?>
                                <script>
                                    $("#subpdf").hide();
                                    $("#excel").hide();
                                    $("#view").hide();
                                </script>
                            </div>
                            <!--</div>-->
                        </div>
                    </div>
                </div>
            </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>
</html>
