<!DOCTYPE html>
<html lang="en">
<?php
    include_once '../account/session.php';
    include_once 'scripts.php';
    $id_manager=$_SESSION['id-manager'];
    $username_manager=$_SESSION['username-manager'];
    $row=get();
?>
    
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Manage Mailers</title>
    <link type="text/css" href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link type="text/css" href="../../bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
    <link type="text/css" href="../../css/theme.css" rel="stylesheet">
    <link type="text/css" href="../../images/icons/css/font-awesome.css" rel="stylesheet">
    <link type="text/css" href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600' rel='stylesheet'>
    <script src="../../scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../../scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
    <script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="../../scripts/flot/jquery.flot.js" type="text/javascript"></script>
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    
    <?php include('../include/inc.top_menu.php'); ?>

    <div class="wrapper">
        <div class="container">
            <div class="row">
                
				<?php include('../include/inc.left_menu.php'); ?>
				
                <div class="span9">
                    <div class="content">
                        <div class="module">
                            <div class="module-head"><h3>Edit Mailer<div class="processing" id="processing"></div></h3></div>
                            
                            <div class="module-body">
                                <div class="alert" id="message-warning">
                                    <button type="button" class="close" onclick="close_message_warning();">×</button>
                                    <strong>Warning!</strong> Please verify your data
                                </div>
                                <div class="alert" id="message-warning-custom">
                                    <button type="button" class="close" onclick="close_message_warning_custom();">×</button>
                                    <strong>Warning!</strong> <span id="message-custom"></span>
                                </div>
                                <div class="alert alert-error" id="message-error">
                                    <button type="button" class="close" onclick="close_message_error();">×</button>
                                    <strong>Error!</strong> There was an error while executing your request
                                </div>
                                <div class="alert alert-success" id="message-success">
                                    <button type="button" class="close" onclick="close_message_success();">×</button>
                                    <strong>Done!</strong> Mailer has been updated successfully
                                </div>
                                <div class="form-horizontal row-fluid">
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">First Name</label>
                                        <div class="controls">
                                            <input type="text" id="first_name" placeholder="" value="<?php echo $row['first_name'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Last Name</label>
                                        <div class="controls">
                                            <input type="text" id="last_name" placeholder="" value="<?php echo $row['last_name'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Username</label>
                                        <div class="controls">
                                            <input type="text" id="username" placeholder="" value="<?php echo $row['username'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Password</label>
                                        <div class="controls">
                                            <input type="password" id="password" placeholder="" value="<?php echo $row['password'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Confirm Password</label>
                                        <div class="controls">
                                            <input type="password" id="confirm_password" placeholder="" value="<?php echo $row['password'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Address Email</label>
                                        <div class="controls">
                                            <input type="text" id="address_email" placeholder="" value="<?php echo $row['address_email'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">IM ID</label>
                                        <div class="controls">
                                            <input type="text" id="im_id" placeholder="" value="<?php echo $row['im_id'];?>" class="span4">
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Status</label>
                                        <div class="controls">
                                            <select tabindex="1" data-placeholder="Select here..." id="status" class="span3">
                                                <option value="Active" <?php if($row['status']=='Active')echo 'Selected'; ?> >Active</option>
                                                <option value="Under Review" <?php if($row['status']=='Under Review')echo 'Selected'; ?> >Under Review</option>
                                                <option value="Stopped Temporarily" <?php if($row['Stopped Temporarily']=='Active')echo 'Selected'; ?> >Stopped Temporarily</option>
                                                <option value="Suspended" <?php if($row['status']=='Suspended')echo 'Selected'; ?> >Suspended</option>
                                                <option value="Cancelled" <?php if($row['status']=='Cancelled')echo 'Selected'; ?> >Cancelled</option>
                                            </select>
                                            <script>
                                                $(document).ready(function(){
                                                    $('#status option[value=' + <?php echo $row['status'];?> + ']').attr('selected', 'selected');
                                                });
                                            </script>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Date Add</label>
                                        <div class="controls">
                                            <input type="text" id="basicinput" placeholder="" value="<?php echo $row['date_add'];?>" class="span3" disabled>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput">Date Last Update</label>
                                        <div class="controls">
                                            <input type="text" id="basicinput" placeholder="" value="<?php echo $row['date_set'];?>" class="span3" disabled>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="basicinput"></label>
                                        <div class="controls">
                                            <a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal">Update Mailer</a>
                                            <button class="btn btn-default" type="button" onclick="location.href='show.php'">Back to show</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div><!--/.content-->
                </div><!--/.span9-->
            </div>
        </div><!--/.container-->
    </div><!--/.wrapper-->


    <!-- Modal -->
    <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Confirmation</h3>
      </div>
      <div class="modal-body">
        <p>You're about to update Mailer <strong><?php echo $row['username'];?></strong></p>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true" onclick="set(<?php echo $row['id'];?>);">Save changes</button>
      </div>
    </div>
</body>