<?PHP
$auth = false;
$authID = 'EAE5972B-83F4-2760-1CCC-96C6F52BAF0D';
if (isset($_COOKIE["guid"])) {
    if ($_COOKIE["guid"] === $authID) {
        $auth = true;
    }
}
if (isset($_POST["username"]) && isset($_POST["password"])) {
    if ($_POST["username"] === 'sales' && $_POST["password"] === '7ab1f81c336ef987a09842fa12638631') {
        $auth = true;
    }
}
// $.md5(md5)
// $.cookie("guid")
// $.cookie("guid", 0, { path: '/projects/certificates', expires: 8000 });
if ($auth) {
    setcookie("guid",$authID,time() + (10 * 365 * 24 * 60 * 60));
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>Certificate</title>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
    <link href="css/profile.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .giftmessage {
            z-index: 1000;
            position: fixed;
            height: auto;
            width: auto;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            background-color: #FFF;
            border-style: solid;
            border-width: unset;
            border-color: #000;
            min-width: 300px;
            text-align: left;
        }


        .giftheader {
            font-size: 150%;
            text-align: center;
        }

        .giftmessage .close {
            float: right;
            padding: 5px;
            color: crimson;
            font-size: 105%;
            font-weight: bolder;
        }

        .giftmessageinner {
            padding: 20px;
        }

        .giftmessage .item {
            padding: 5px;
        }
    </style>
    <!-- <link rel="Shortcut Icon" type="image/x-icon" href="/images/Logo.png" /> -->
    <script>
        certificate = {}
        // certificate.shared = {}
        // certificate.contacts = {}
        // certificate.docs = {}
        certificate.v = {}
    </script>


    <script type="text/javascript" src="jsinclude/jquery-1.11.3.js"></script>
    <script type="text/javascript" src="jsinclude/jquery-ui.min.js"></script>

    <!--
        <script type="text/javascript" src="jsinclude/modernizr.min.js"></script>
        <script type="text/javascript" src="jsinclude/jquery.md5.js"></script>
        <script type="text/javascript" src="jsinclude/jquery.cookie.js"></script>
        <script type="text/javascript" src="jsinclude/moment.min.js"></script>
        <script type="text/javascript" src="jsinclude/moment-timezone.js"></script>
-->
    <!--         <script>
            if (location.protocol != "https:") {
                location.href = 'https://rephrecruiting.com/profile/';
            }
            if (location.href.indexOf("#") != -1) {
                if (location.href.length > 36) {
                    if ($.cookie("b") === 'n') {
                        history.pushState({}, null, '/profile/');
                    } else {
                        location.href = '#';
                    }
                }
            }

        </script> -->
    <script type="text/javascript" src="js/shared.js"></script>
    <script type="text/javascript" src="js/transfer.js"></script>

</head>

<body>
    <div id="status"><span></span></div>
    <div id="header">
        <img src="images/logo.jpg" id="logo" alt="" />
        <br />
        <br />
        <br />


        <div id="menu" onClick=""></div>

        <!-- <div id="logout" onclick="< ? echo urlLogout(); ? >">logout</div> -->
        <div class="title"><a href="/certificates/?">Gift Certificate Portal</a></div>
    </div>


    <br />
    <br />
    <br />
    <div id="main">
        <div id="spreadsheet" style="float: right;" class="button"> <a href="spreadsheet.php">GC Records</a> </div>
        <br />
        <hr class="hrr" width="200px" align="right">
        <br />
        <form id="certificates">
            <div id="orderBody">
                <div class="certItem">
                    <code onclick="alert('Orders with 4 digits will send via email. 5 or more digits  will add to record');">ⓘ</code>
                    <div class="itemLabel order"> Order: </div>
                    <div class="certField">
                        <input type="text" id="order" name="order" class="certbox" value="">
                    </div>
                </div>

                <div class="certItem" onclick="certificate.order.toggleOrderJustRecord();">
                    <!-- <div class="itemLabel order"> Just add record (don't send email): </div> -->
                    <div class="itemLabel order"> Record only: </div>
                    <div class="certField">
                        <input type="checkbox" id="justrecord" name="justrecord" value="" style="width: 20px; height: 20px;" onclick="certificate.order.toggleOrderJustRecord();">
                    </div>
                </div>



                <div class="certItem" id="esendparent" style="display: none;" onclick="certificate.order.toggleOrderEmailSend();">
                    <div class="itemLabel order"> Send via Email: </div>
                    <div class="certField">
                        <span id="esendlabel" class="button" title="click to change" >Yes</span>
                        <input type="hidden" name="esend" id="esend" value="1">
                    </div>
                </div>


                <div class="certItem">
                    <div class="itemLabel order"> Count: </div>
                    <div class="certField">
                        <input type="text" id="count" name="count" class="certbox sbox" value="1">
                    </div>
                </div>
                <div class="certItem">
                    <div class="itemLabel order" onclick="certificate.order.editPulldownAsk();" > GC Value: </div>
                    <div class="certField">
                        <!-- <input type="text" id="dvalue" name="dvalue" class="certbox" value="One Hour Swedish Massage" style="width:180px;"> -->

<label>
  <div class="datalist-wrap">
    <div class="input-wrap">    
      <input id="dvalue" type="text" name="dvalue" list="values"/>
    </div>
    <datalist id="values">

    <label>
    <select name="values" >
    <?
        include('_functions2.php');
        $pulldownFile = getFile( 'pulldown_dvalue.txt' );
        // echo $pulldownFile;

        foreach(explode("\n",$pulldownFile) as $key) {
            echo "<option value='$key'>";
        }

    ?>
     

    </select>
     </label>

    </datalist>
  </div>
 </label>

                    </div>
                </div>











<!--
                <div class="certItem">
                    <div class="itemLabel order"> Card Type: </div>
                    <div class="certField">
                        <input type="radio" name="cardtype" id="cardtype1" value="1" checked> <label for="cardtype1">Gold</label>
                        <input type="radio" name="cardtype" id="cardtype0" value="0" > <label for="cardtype0">Black</label>
                    </div>
                </div>
-->


                <div class="certItem" onclick="certificate.order.toggleOrderCardType();">
                    <div class="itemLabel order"> Card Type: </div>
                    <div class="certField">
                        <span id="cardtypelabel" class="button" title="click to change" >Certificate</span>
                        <input type="hidden" name="cardtype" id="cardtype" value="3">
                    </div>
                </div>




                <div class="certItem">
                    <div class="itemLabel order"> Tip: </div>
                    <div class="certField">
                        <input type="text" id="totaltip" name="totaltip" class="certbox sbox" value="0" >
                    </div>
                </div>

                <div class="certItem" >
                    <!-- <div class="itemLabel order"> Just add record (don't send email): </div> -->
                    <div class="itemLabel order"> Split Tip: </div>
                    <div class="certField">
                        <input type="checkbox" id="splittip" name="splittip" value="" style="width: 20px; height: 20px;" >
                    </div>
                </div>



                <div class="certItem" id="giftparent"  onclick="certificate.order.toggleOrderGift();">
                    <div class="itemLabel order"> Send as Gift: </div>
                    <div class="certField">
                        <span id="giftlabel" class="button" title="click to change" >No</span>
                        <input type="hidden" name="gift" id="gift" value="0">
                    </div>
                </div>

                <div class="certItem" id="giftchild"  onclick="certificate.order.toggleOrderGiftMessage();" style="display: none;">
                    <div class="itemLabel order"> Include Gift Message: </div>
                    <div class="certField">
                        <span id="giftmessagelabel" class="button" title="click to change" >No</span>
                        <input type="hidden" name="giftmessage" id="giftmessage" value="0">
                    </div>
                </div>


                <div class="certItem">
                    <div class="itemLabel order"> &nbsp; &nbsp; </div>
                    <div class="certField">
                        <span id="processButton" class="button" onclick="certificate.order.processOrder();">process</span>
                    </div>
                </div>
            </div>
            <br />
            <br />
            <div id="contactBody"></div>
            <br />
            <br />
            <br />
            <span id="contactAddButton" class="button" onclick="certificate.order.add();" style="display: none;">Add Contact</span>
            <input type="hidden" id="JSON" name="JSON">
        </form>
        <div id="insertButton"></div>
    </div>

    

    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <script type="text/javascript">
        
        $('#dvalue').keyup(function() {
            certificate.order.dValWidth();
        });

        $('#dvalue').change(function() {
            certificate.order.dValWidth();
        });

    </script>



</body>

</html>
<?
} else {
    @include('login.php');
}
?>

