<?php

include('views/_header.tpl.php');

if (isset($_GET['msg'])) {
    $msg = htmlentities(strip_tags($_GET['msg']));
}

?>

<style>
    #mmen { display:none; }
    div.spacer { padding-top: 45px; }
    .tinybutton { padding:3px 7px; background:#fff; width:65px;  min-width:65px;
        border-radius: 50px; -moz-border-radius: 50px; -webkit-border-radius: 50px; font-size:12px; }
        
     input.txt { font-size:17px; padding:25px; font-weight:300; }
     input[type="button"], input[type="submit"] { font-size:17px; padding:15px 25px; width: 150px; font-weight:300 !important; }
        
 /* ############################################### */
/* ####### The Switch - the box around the slider ####### */
/* ############################################### */

.switch {
  position: relative;
  display: inline-block;
  width: 60px !important;
  height: 32px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.sliderr {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.sliderr:before {
  position: absolute;
  content: "";
  height: 28px;
  width: 28px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .sliderr {
  background-color: #98cb54;
}

input:focus + .sliderr {
  box-shadow: 0 0 1px #98cb54;
}

input:checked + .sliderr:before {
  -webkit-transform: translateX(28px);
  -ms-transform: translateX(28px);
  transform: translateX(28px);
}

/* Rounded sliders */
.sliderr.round {
  border-radius: 32px; -moz-border-radius: 32px; -webkit-border-radius: 32px;
}

.sliderr.round:before {
  border-radius: 50%;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  
}
/* ############################################### */
/* ##############     The Switch ENDS     ############## */
/* ############################################### */              

 /* ##################################### */
/* ############     MOBILE      ############# */
/* ##################################### */

/* ######################### */
/* Landscape phones and down */
/* ######################### */

    /* @media screen and (max-device-width:  600px), screen and (max-width: 600px) { */
    @media (max-width: 600px) {
    .home-feature-category { margin-top:20px; }
}       
</style>

 <div class="home-feature-category" style="background:none; border:none; padding-top:0px;">
     <?php if(isset($_GET['msg'])) : ?>
     <div style="background:#cd1000; color:#fff; font-weight:300; height:25px; line-height:25px; margin-top:3px; text-align:center; padding:5px 0;">
         Saved Successfully! <a href="/admin/?modlist&edit=<?= $modifierList['modifier_list_id'] ?>" class="tinybutton">Ok!</a>
     </div>
     <?php endif; ?>

        <div class="container_12 clearfix" style="padding-top:7px;">
            
        <div class="grid_12 marked-category">
      
        <h1 style="margin-bottom:0px;"><?php
        
		if ($modifierList) {
            echo "Edit";
        } else {
            echo "Add";
            $def = "static/system/placeholder.jpg";
        }
        
        ?> Modifier List/Seats</h1>
        
        <form method="post" class="form form-profile" enctype="multipart/form-data" style="padding:25px 0px 0px;">
        
        
			<p class="rs description-input" style="margin-left:55px !important; color:#000; font-style:normal !important;">
				<span style="font-size:18px;"><strong>MODIFIERS OR SEATS FOR</strong></span><br />
			</p>

			<div class="row-item clearfix" style="padding-bottom:0px;">
				<label class="lbl" for="txt_name1" style="text-align:left; width:50px; margin-right:5px; margin-bottom:5px">Item:</label>
				<div class="val" style="margin-left:0px; margin-top:6px; font-size:15px;">
					<?= $modifierList['modifier_list_name'] ?>
					<p class="rs description-input"></p>
				</div>
			</div>				
			<div class="row-item clearfix" style="padding-bottom:10px;">
				<label class="lbl" for="txt_name1" style="text-align:left; width:50px; margin-right:5px; margin-bottom:5px">ItemID:</label>
				<div class="val" style="margin-left:0px; margin-top:6px; font-size:15px;">
					<?= $modifierList['modifier_list_id'] ?>
					<p class="rs description-input"></p>
				</div>
			</div>			
			
<!--			<div class="row-item clearfix" style="padding-bottom:10px;">
				<label class="lbl" for="txt_name1" style="text-align:left; width:50px; margin-right:5px;">Type:</label>
				<div class="val" style="margin-left:0px;">
					<select name="selection_type" id="" class="txt" style="background:#f0f0f0; width:200px; font-size:15px">
						<option value="">Select Type</option>
						<option value="MULTIPLE">MULTIPLE</option>
						<option value="SINGLE">SINGLE</option>
					</select>
				</div>
			</div>	-->		
			
			<table class="admintable" style="margin:10px; width:97% !important; min-width:97% !important; display:nonex; background:none;">
				<tr>
					<th width="50" style="text-align:left">ID</th>
					<th width="140" style="text-align:left">LIST NAME</th>
					<th width="100" style="text-align:left">NAME</th>
					<th width="20" style="text-align:left">SORT</th>
					<th width="20" style="text-align:left">SORT</th>
					<th width="40" style="text-align:left">STOCK #</th>
					<th width="20" style="text-align:left">IN STOCK</th>
					<th width="70" style="text-align:left; max-width:70px;">TYPE</th>
					<th width="30" style="text-align:left">EDIT</th>
				</tr>			
				
				<?php
					foreach ($modifierList['modifiers'] as $modifier) { 
						//print_r($modifier); 
//						if($modifier['in_stock'] == 1) {
//							$checked = "checked";
//						} else {
//							$checked = "";
//						}
				?>
					<tr>
						<td>
							<input class="txt" type="text" name="id[]" value="<?= $modifier['id'] ?>"
							readonly style="background:#eee;">
						</td> 
						<td>
							<input class="txt" type="text" name="modifier_id[]" value="<?= $modifier['modifier_id'] ?>"
							readonly style="background:#eee; font-size:14px;">
						</td>
						<td>
							<input class="txt" type="text" name="modifier_name[]" value="<?= $modifier['modifier_name'] ?>" 
							readonly style="background:#eee;">
						</td>
						<td>
							<input class="txt" type="text" name="ordinal[]" value="<?= $modifier['ordinal'] ?>"
							 style="background:#fff;">	
						</td>
						<td>
							<input class="txt" type="text" name="sort_order[]" value="<?= $modifier['sort_order'] ?>"
							style="background:#fff;">		
						</td>
						<td>
							<input class="txt" type="text" name="stock_num[]" value="<?= $modifier['stock_num'] ?>"
							style="background:#fff;">
						</td>
						<td>
							<input class="txt" type="text" name="in_stock[]" value="<?= $modifier['in_stock'] ?>"
							style="background:#fff;">
						</td>
						<td>
							<select name="selection_type[]" id="" class="txt" style="background:#f0f0f0; width:100%; font-size:15px">
								<option value="">Select Type</option>
								<option value="MULTIPLE" <?php
								if ($modifier['selection_type'] == "MULTIPLE") {
									echo "selected"; } ?>>MULTIPLE</option>
									<option value="SINGLE" <?php
									if ($modifier['selection_type'] == "SINGLE") {
										echo "selected"; } ?>>SINGLE</option>
							</select>
						</td>												
						<td>
							<div style="width:50px; background:none; text-align:center;">
								<!--<input type="checkbox" name="in_stock_status[]" value="<?= $modifier['in_stock'] ?>" <?= $checked ?>>-->
								
								<input type="checkbox" name="edit_this[]" value="">
							</div>
						</td>
					</tr>
				
				<?php } ?>
			
			</table>
			<!-- at_locations[] -->
			
			<!-- MODIFIER LISTS -->
			<div class="row-item clearfix modifiers" style="background:none; padding:0 10px 10px">
				<!--<span style="font-size:18px;"><strong>ADD MODIFIERS</strong></span><br />-->

				<div class="val" style="margin-left:0px; background:none">
				
				<!-- <td style="display:none"><div style="width:55px; text-align:center;"><a href="/admin/?modifier&edit=' . $modifier['id'] . '&deleteModifier=' . $modifier['id'] . '">delete</a></div></td> -->

					<div id="first_modifier" style="background:none; width:100%; display:nonex;">
						<input class="form txt" placeholder="-" style="width:96px; margin-right:0px; background:#eee;" readonly />
						<input class="form txt" placeholder="-" style="width:263px; margin-right:3px; background:#eee;" readonly />
						<input class="form txt" name="mod_name[]" placeholder="Name" style="width:190px; margin-right:2px" />
						<input class="form txt" placeholder="-" style="width:65px; background:#eee;" readonly />
						<input class="form txt" name="mod_sort_order[]" placeholder="#" style="width:65px" />
						<input class="form txt" name="mod_stocknum[]" placeholder="Stock#" style="width:80px" />
						<input class="form txt" name="mod_instock[]" placeholder="In-Stock" style="width:80px; font-size:14px;" />

						<select name="selection_type[]" id="" class="txt" style="background:#f0f0f0; width:135px; font-size:15px">
							<option value="">Select Type</option>
							<option value="MULTIPLE">MULTIPLE</option>
							<option value="SINGLE">SINGLE</option>

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

					<div class="dynamicSection"></div>

					<p class="rs description-input" style="margin-top:10px;">
						<a href='javascript:;' onclick='addModifier()' class='btn-blue btn'
								style='margin-left:0px;'>+add another Modifier</a></p>


					<!--<?php if($squareuser['usertype'] == 'MULTIPLE') echo "selected"; ?>-->
				</div>
			</div>
			<!-- MODIFIER LISTS ENDS -->				
             
            <br />
			<input type="submit" style="font-weight:300" class="btn btn-black" /> <input type="button" 
            value="Cancel" class="btn btn-black" onclick="location = '/admin/'" />
            <br /><br />
            
        </form>

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

<script type="application/javascript" >
    var barCheckBox = document.getElementById('bar').value;
    var clubCheckBox = document.getElementById('club').value;
    var searchBox = document.getElementById('at_locations').value;
    
    function updateAtLocations() {
        if (barCheckBox.checked) {
            searchBox.value += ' Bars';
        } else if (clubCheckBox.checked) {
            searchBox.value += ' Clubs';
        } else {
            searchBox.value = '';
        }
    }
</script>

<script>
	function addLevel()
	{
		$('.levels .dynamicSection').append($('#first_level').html());
	}
	function addModifier()
	{
		$('.modifiers .dynamicSection').append($('#first_modifier').html());
	}
</script>

<?php

include('views/_footer.tpl.php');

?>