<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$language.lblAdmin} : {$language.lblFormSubmission}</title>
{include file='CommonStyles.tpl'}
{include file='CommonJavaScript.tpl'}
<script type="text/javascript" src="{$common_js}/jsrender.plugin.js"></script>
<script type="text/javascript" src="{$common_js}/dateformat.plugin.js"></script>
<script type="text/javascript" src="{$common_js}/jsrender.helper.js"></script>
<link rel="stylesheet" type="text/css" href="{$view_styles}/grid_listing.css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/right-menu.css" />
<link href="{$view_styles}/jquery-ui-1.8.19.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/ui.daterangepicker.css" />
{include file='CommonCustomStyles.tpl'}
</head>
<body>
<div class="outer_container"> {include file='CommonTop.tpl'}
  <!--End:Header Container-->
  <!--*****************************************************END HEADER CONTAINER**********************************************-->
  <div class="content_container2 clearfix">
    <div class="right-sidebar">
      <div class="side_wrapper">{if $addPrivilege} {html->anchor priv_href="form/new/" href="form/new/" caption="<strong><span class='add'></span>{$language.lblAddNewForm}</strong>" class="custom-btnt"}{/if}
        <ul>
          <li>{html->anchor priv_href="form/index/" href="/form/index/" rel="listcontentsection" class="side_menu_a " content="{$language.lblListForms}<br />
            <span>{$language.lblManageForms}</span>"} </li>		
			<li>{if $editPrivilege}
				{html->anchor priv_href="form/build/" href="form/build/id/{$formID}/"  class="side_menu_a" content="{$language.lblEditForm}<br /><span>{$language.lblEditThisForm}</span>"} 
			{/if}
			</li>	
        </ul>
      </div>
    </div>
    <!--End: Right Block-->
    <div class="left_wrapper">
      <div class="content_wrapper">
        <h2>{$language.lblForms} - {$resultForm['formName']} </h2>{if $resultForm['formStatus']=='Inactive'}{$language.lblInactive}{/if}
        <div class="clear"></div>
        <div id="common_message" ></div>
		<div class="clearfix">{include file='ContentLanguageOptions.tpl'}</div>
           <div class="search_container">
            <div class="inner wide-box"> {form->start name="formContentSearch" action="" method="post" enctype="multipart/form-data"}              <ul class="clearfix">
            	<li class="column">
                	<p class="label-field01">{$language.lblSubmittedDate}</p>
                    <span class="form-field01">
				     {form->textbox class="select-box width-234px" name="searchSubmittedDate"} 
                   </span>
                </li>
				{foreach $searchField as $field} 
					{if $field['type']=='text' ||  $field['type']=='email' ||   $field['type']=='textarea' ||   $field['type']=='website'}
					<li class="column">
						<p class="label-field01">{$field['label']}</p>
						<span class="form-field01">
						 {form->textbox class="textbox width-234px" name="{$field['name']}"} 
					   </span>
					</li>
					{else if $field['type']=='select' || $field['type']=='checkbox'  || $field['type']=='radio' }
					<li class="column">
						<p class="label-field01">{$field['label']}</p>
						<span class="form-field01">
						 {form->select class="select-box width-234px" caption="->{$language.lblSelect}" options=$field['options'] name="{$field['name']}"} 
					   </span>
					</li>
					{else if $field['type']=='country' }
					<li class="column">
						<p class="label-field01">{$field['label']}</p>
						<span class="form-field01">
						 {form->select class="select-box width-234px" caption="->{$language.lblSelect}" options=$field['options'] name="{$field['name']}"} 
					   </span>
					</li>
					{else if $field['type']=='businesstype' }
					<li class="column">
						<p class="label-field01">{$field['label']}</p>
						<span class="form-field01">
						 {form->select class="select-box width-234px" content=$field['options'] name="{$field['name']}"} 
					   </span>
					</li>
					{else if $field['type']=='date' }
					<li class="column">
						<p class="label-field01">{$field['label']}</p>
						<span class="form-field01">
						 {form->textbox name={$field['name']} class="textbox width-234px"}
									<script type="text/javascript">
											//<![CDATA[
                                            $(document).ready(function(){
												$("#{$field['name']}").datepicker();
											});
											//]]>
									</script>	
					   </span>
					</li>
					 {/if}
				{/foreach}
                <li class="column"> 
				{if $searchField|count%4!=0 || count($searchField)==0}
                <p class="label-field01">&nbsp;</p>   
				{/if}             	
                    {form->submit name="submitSearch" tabindex="1"  class="button01" value="{$language.lblSearch}"} 
                    {html->anchor href="/form/submission/id/{$formID}/" tabindex="1" caption=$language.lblListAll  class="action-link"}
                </li>
              </ul>
              {form->close}
              <div class="clear"></div>
            </div>
           </div>
        {if $resSubmissions}
		<div class="clearfix">
        {html->anchor class="button-link01 fixing_right" href="/form/export/type/submission/id/{$formID}/" content="{$language.lblExport}"}</div>
        <div class="grid_table00 submission-list">{form->start name="frmContentList" action="" method="post"}
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="contentList" >			
			<thead id="submissionlistHead">
            </thead>
			<tbody id="submissionlistBody">
			</tbody>			
			<script id="submissionlistHeadData" type="text/x-jsrender">
				<tr class="nodrag nodrop">
					<th align="left" valign="middle"  class="checkbox_column" width="35"> 
						<div class="chekingdiv">
							<ul>
							  <li>
								 {form->checkbox id="ListStatusLinkCheckbox" class="fixing_left" tabindex="1"}
							{*{html->anchor href="" id="ListStatusLink" class="status-arw fixing_left"}
								<ul id="ListStatusSelection" class="check_status">
								  <li> {html->anchor href="" rel="ListActive" content=$language.lblActive}</li>
								  <li> {html->anchor href="" rel="ListInactive" content=$language.lblInactive}</li>
								  <li> {html->anchor href="" rel="ListAll" content=$language.lblSelectAll}</li>
								</ul>*}
							  </li>
							</ul>
						</div>						
					</th>
					{foreach $resultElement as $element}
						{assign var="formElementName" value=$element.attributeType|cat:"_"|cat:$element.formElementID}
						[[if ~{$formElementName}]] 	
							{if $element.attributeType!='html' && $element.attributeType!='submit' && $element.attributeType!='text_opt'}
								<th align="left" valign="middle">{$element.formElementLabel}</th>
							{/if}
						[[/if]] 	
					{/foreach}
					[[if ~submittedIP]] 
						<th align="left" valign="middle">{$language.lblSubmittedIP}</th>
					[[/if]]		
					<th align="left" valign="middle">{$language.lblCreatedDate}</th>
					</th>
					{if $cstatusPrivilege || $showPrivilege || $deletePrivilege} 
					<th width="70" align="left" valign="middle">
					 <span>
						<div class="tool-tip02 fieldlist"> 
							<div class="main-strip clearfix">
								<span class="arw"></span> <span class="arw1"></span> 
							</div>
							<div class="list-box">
							{foreach $resultElement as $key=>$element}
							{assign var="formElementName" value=$element.attributeType|cat:"_"|cat:$element.formElementID}
							{if $element.attributeType!='html' && $element.attributeType!='submit' && $element.attributeType!='text_opt' &&   $element.attributeType!='file'  && $element.attributeType!='image'}
								<div class="elements sub-strip clearfix"  data-element="{$formElementName}">
											[[if ~{$formElementName}]] 	
											<span class="clmn c1">
												<span class="show02 icon-set" title="{$language.lblShow}"></span>
											</span>
											[[/if]]
											<span class="clmn c2">{$element.formElementLabel}</span>
								</div>
								{/if}
							{/foreach}
								<div class="elements sub-strip clearfix"  data-element="submittedIP">
											[[if ~submittedIP]] 	
											<span class="clmn c1">
												<span class="show02 icon-set" title=" title="{$language.lblShow}"></span>
											</span>
											[[/if]]
											<span class="clmn c2">{$language.lblSubmittedIP}</span>
								</div>
							</div>
						</div>
					  </span>	
					</th>{/if}
              </tr>
			</script>
			<script id="submissionlistBodyData" type="text/x-jsrender">
				<tr>
					<td align="left" >
					{form->checkbox name="submissions[]" value="[[>submissionDetailsID]]" class="checkbox01 ListAll List[[>submittedDataStatus]]"}
					</td>      
					{foreach $resultElement as $key=>$element}
						{assign var ='extraAttributes' value=$element.extraAttributes|json_decode}
						{if $element.attributeType!='html' && $element.attributeType!='submit' && $element.attributeType!='text_opt'}
							{assign var="formElementName" value=$element.attributeType|cat:"_"|cat:$element.formElementID}
								[[if ~{$formElementName}]] 	
									
								{if isset($extraAttributes->allowUserChoice->child) && $extraAttributes->allowUserChoice->child!=''}
									<td align="left" valign="middle">	
										[[>{$formElementName}]] 
										[[>{$extraAttributes->allowUserChoice->child}]]
									</td>
								{else}
									<td align="left" valign="middle">	
										{if $element.attributeType=='date' }
											[[if {$formElementName}!='0000-00-00 00:00:00']] 	
												[[>~formatDate({$formElementName},'{$date_format}',true)]] 	
											[[else]] 	
												-
											[[/if]] 	
										{else}
											[[if {$formElementName}!='-']] 	
												[[>{$formElementName}]] 	
											[[else]] 	
												-
											[[/if]] 	
										{/if}
									</td>
								{/if}
								[[/if]] 	
						{/if}
					{/foreach}
					[[if ~submittedIP]] 
						<td align="left" valign="middle">
							[[>submittedIP]] 	
						</td>
					[[/if]]		
						<td align="left" valign="middle">
								[[>~formatDate(dateSubmitted,'{$date_format}',true)]] 	
						</td>	
{if $cstatusPrivilege || $showPrivilege || $deletePrivilege} 								
					<td align="left" valign="top"> 
					{if $cstatusPrivilege}
					[[if submittedDataStatus=='Active']]
						{html->anchor  ajax_href="/form/changeSubmissionStatus/formid/{$formID}/id/[[>submissionDetailsID]]/status/Inactive" title="[[>submittedDataStatus]]" class="changeStatus status-active icon-set" content=""}
					[[else]]
						{html->anchor ajax_href="/form/changeSubmissionStatus/formid/{$formID}/id/[[>submissionDetailsID]]/status/Active" title="[[>submittedDataStatus]]" class="changeStatus status-inactive icon-set" content=""}
					[[/if]]
					{/if}
					{if $showPrivilege}
					{html->anchor href="form/showsubmission/formid/{$formID}/did/[[>submissionDetailsID]]/" title="{$language.lblPreview}" history="yes" class="preview icon-set" content=""}
					{/if}
					{if $deletePrivilege}
					{html->anchor href="form/submissiondestroy/formid/{$formID}/did/[[>submissionDetailsID]]/" title="{$language.lblDelete}"  history="yes" content="" class="delete02 icon-set" confirm="{$language.msgSelectAtleastOne}" confirm_head="{$language.lblDelete}"}
				  {/if}
				  </td>
				  {/if}
				</tr>
			</script>
			<script type="text/javascript">
				var data={$resSubmissions|json_encode};
				var show={ submittedIP:false};
				{foreach $resultElement as $key=>$element}
					{assign var="formElementID" value=$element['formElementID']}
					{assign var="attributeType" value=$element['attributeType']}
					{assign var="formElementName" value=$attributeType|cat:"_"|cat:$formElementID}
					{assign var="extraAttributes" value=$element['extraAttributes']|json_decode}
					{if (isset($extraAttributes->defaults->showInList) && $extraAttributes->defaults->showInList=='true') && $attributeType!='file' && $attributeType!='image'}
						show['{$formElementName}']=true;
					{else}
						show['{$formElementName}']=false;
					{/if}
				{/foreach}
				function switchTemplates() {
					html=$( "#submissionlistBodyData" ).render( data ,show);
					$( "#submissionlistBody" ).html( html );
					html=$( "#submissionlistHeadData" ).render({},show);
					$( "#submissionlistHead" ).html( html );
				}
				switchTemplates();
			</script>	
          </table>
        </div>
         <div class="fixing_right pagination_outer"> {paginate->layout  key="page" label_record="{$language.lblRecorsFound}" label_pages="{$language.lblPages}"} 
          <!--end: Pagination-->
          <div class="clear"></div>
        </div>
		{if $cstatusPrivilege}
        <div class="fixing_left">{form->select name="submissionStatus" class="select-box width-auto" options="->Select~*Active->{$language.lblActive}~*Inactive->{$language.lblInactive}~*Deleted->{$language.lblDelete}"}
          {form->submit name="submitBulkStatus" id="submitBulkStatus" class="update_btn_table button04" value=$language.lblUpdate} </div>{/if}
        {form->close}
        <div class="clear"></div>
        {else}
        <div class="message_info" id="common_message">{$language.msgNoRecords}</div>
        {/if}
	    </div> 
        <!--End:From Listing-->
      </div>
    </div>
    <!--End: left Block-->
    <div class="clear"></div>
  </div>
  <!--End:Content Container-->
  {include file='CommonBottom.tpl'} </div>
<!--End:Outer Container-->
{include file='CommonJavaScriptBottom.tpl'}
{html->messages_script id="common_message"}
{form->rootpath_script}
{form->basepath_script}
<script type="text/javascript">
	var lblSelectAction	= '{$language.lblSelectAction}';
	var lblSelectItem	= '{$language.lblSelectItem}';
	var msgSelectSearchCriteria="{$language.msgSelectSearchCriteria}";
	var lblSelectStatus	= '{$language.lblSelectStatus}';
	var msgSelectItem	= '{$language.msgSelectItem}';
	var msgDeleteItem	= '{$language.msgDeleteItem}';
</script>
<script type="text/javascript" src="{$view_javascript}/daterangepicker.jQuery.js"></script> 
<script type="text/javascript" src="{$view_javascript}/table.plugin.js"></script>
<script type="text/javascript" src="{$view_javascript}/jquery.multiselect.widget.js"></script> 
<script type="text/javascript" src="{$common_js}/date.js"></script> 
<script type="text/javascript" src="{$view_javascript}/formsubmissions.page.js"></script>

</body>
</html>