	<?php
	echo '
	<script>
		function goBack() {';
			//window.history.back();
			echo '
			window.location.href = "'.$thisPage.'adm1n/'.$curPage1.'"; ';
		echo '
		}
	</script>';
	
	$sql = 
	" select designName from form_label, form_design ".
	" where labelType='".$idEvent."' and labelID=labelParentID and validasi='YES' ". 
	" and active='1' order by designORDER asc";
	//echo "<br> sql : ".$sql; 

	echo '
	<br>
	<div style="padding-bottom:7px">
		<strong>'.$button_label.'</strong>
	</div>
	<form name="formKelengkapanData" id="formKelengkapanData" class="form" action="'.$thisPage.'adm1n/'.$curPage1.'" onsubmit="return validate(this)" method="post">';
        $sql = 
		" select * from form_label ".
		" where labelType='$idEvent' ";
        //echo "<br> sql".$sql; 
        if ($hasil = mysqli_query($conn, $sql)) {		
            while ($rec = mysqli_fetch_array($hasil)) {
                $sql2 = 
				" select * from form_design, form_element ".
				" where elementID = element AND labelParentID = ".$rec["labelID"].
				" and active='1'  order by designORDER asc ";
            	 //	echo $sql2;
                if ($hasil2 = mysqli_query($conn, $sql2)) {
					$os  = array(1220, 1214, 1219);					
					$osx = array(53, 52, 51, 50, 40, 41, 42, 43, 44);	
					//if (in_array($jn_trans, $os)) {
					//	$osx = array(53, 52, 51, 50, 40, 43, 44);	
					//}
					echo '
                    <table width="100%" cellpadding="10" cellspacing="1" border="0" bgcolor="#999999">';
                    while ($rec2 = mysqli_fetch_array($hasil2)) {
                        if (in_array($rec2["designID"], $osx)) {
							echo '
							<tr id="'.$rec2["designID"].'" valign="top" bgcolor="#e4e4e4">
								<td width="28%" style="background-color:#e4e4e4;">
									<strong>'
										.$rec2["labelName"].'<br>'
										.($rec2["labelNameEng"] ? '(<i>'.$rec2["labelNameEng"].'</i>)' : '').'	
									</strong>
								</td>';
								echo '
								<td style="background-color:#e4e4e4;">
									'.$rec2["elementName"]($rec["labelID"], $rec2["designID"], 0, "form_design", "form_element", "elementID", "element", "labelParentID", "designID").'									
								</td>
							</tr>';
						}
                    }
					if ($_SESSION['username'] == 'super' && $button_label == 'Add New Record') {
                        echo '
                        <tr valign="top" bgcolor="#e4e4e4">
                            <td width="28%" style="background-color:#e4e4e4;">
                                <strong>Remark</strong>
                            </td>';
                            echo '
                            <td style="background-color:#e4e4e4;">
								<input type="checkbox" name="remark" id="remask">
							</td>
                        </tr>';
                        echo '
                        <tr valign="top" bgcolor="#e4e4e4">
                            <td width="28%" style="background-color:#e4e4e4;">
                                <strong>PIC</strong>
                            </td>';
                            echo '
                            <td style="background-color:#e4e4e4;">
								<input type="checkbox" name="pic" id="pic">
							</td>
                        </tr>';
					}
                    echo '
                        <tr valign="top" bgcolor="#e4e4e4">
                            <td align="center" colspan="2">
                                <div style="margin:20px 0px" align="center">
									<div onclick="goBack()" class="hvr-sweep-to-right" style="padding:10px 30px; cursor:pointer;">
										<font style="color:#ffffff; text-align:center">
											<< Back
										</font>
									</div>
									<div id="submitformKelengkapanData" class="hvr-sweep-to-right" style="padding:10px 30px; cursor:pointer;">
										<font style="color:#ffffff; text-align:center">
											Submit >>
										</font>
									</div>
									<input type="hidden" name="action" id="action" value="'.(isset($button_label) ? $button_label : "").'" />
									<input type="hidden" name="button_event" id="button_event" value="'.(isset($button_event) ? $button_event : "").'" />
                                	<input type="hidden" name="header_id" id="header_id" value="'.(isset($header_id) ? $header_id : "").'" />
									
									<input type="hidden" name="users"  id="users"  value="users" />
									<input type="hidden" name="pass"   id="pass"   value="'.(isset($_REQUEST["pass"]) ? $_REQUEST["pass"] : null).'" />
									
									<input type="hidden" name="add"    id="add"    value="'.(isset($_REQUEST["add"]) ? $_REQUEST["add"] : null).'" />
									<input type="hidden" name="edit"   id="edit"   value="'.(isset($_REQUEST["edit"]) ? $_REQUEST["edit"] : null).'" />
									<input type="hidden" name="delete" id="delete" value="'.(isset($_REQUEST["delete"]) ? $_REQUEST["delete"] : null).'" />
									<input type="hidden" name="view"   id="view"   value="'.(isset($_REQUEST["view"]) ? $_REQUEST["view"] : null).'" />
									
								</div>
                            </td>
                        </tr>
                    </table>
                    <br>';
                }
            }
        }
		echo '
    </form>';										
	?>
	