<?php
// file: public/partials/cemetery-sexton-interment.php
/**
 * Provide a public-facing view for the plugin
 *
 * This file is used to markup the public-facing aspects of the plugin.
 *
 * @link       https://orbicular.media
 * @since      1.1.0
 *
 * @package    Cemetery_Sexton
 * @subpackage Cemetery_Sexton/public/partials
 */
?>

<div id="interment-info">
<?php   
    // Get interment photo
    $interPhoto = $interData->interment_displayInterPhoto($interid);
    echo $interPhoto;
    ?>
<div id="interment-data">
<h3><?php //output interment name
echo $interName; ?></h3>
<?php 
    // Obits related to Interment
    $obits = $interData->interment_displayObits($interid);
    echo $obits; 
?>
<div class="subheading">Lived</div>
<div class="data"><?php 
    $DateBirth = isset($rsInter['DateBirth']) ? $tools->tools_dateFormatPretty($rsInter['DateBirth']) : 'Unknown';
    $DateDeath = isset($rsInter['DateDeath']) ? $tools->tools_dateFormatPretty($rsInter['DateDeath']) : 'Unknown';
    echo $DateBirth.' to '.$DateDeath; 
    ?></div>
<div class="subheading">Interred</div>
<div class="data"><?php
    $DateInt = isset($rsInter['DateInt']) ? $tools->tools_dateFormatPretty($rsInter['DateInt']) : 'Date Unknown';
    echo $DateInt;
    ?></div>
<div class="subheading">Spouse or Parent</div>
<div class="data"><?php
    $SpouseParent = isset($rsInter['SpouseParent']) ? $rsInter['SpouseParent'] : 'Not Listed';
    echo $SpouseParent;
    ?></div>
<div class="subheading">Survived By</div>
<div class="data"><?php
    $InterObit = isset($rsInter['Obit']) ? $rsInter['Obit'] : 'Not Listed';
    echo $InterObit;
    ?></div>
</div>

</div>
<div id="interment-lot">
<h4> <i class="fas fa-map-marked-alt"></i> Lot Information</h4>
<h3><?php echo $lotLocation; ?></h3>
<?php //output obits
echo $lotLink; ?>
<table class="cemetery-sexton-results-list">
	<thead>
		<tr>
			<th class="title" id="header-name">Name</th>
			<th class="title" id="header-dob">Date of Birth</th>
			<th class="title" id="header-dod">Date of Death</th>
		</tr>
	</thead>
	<tbody>
	<?php
	foreach ($sameLot as $rsSameLot){
	    //$link = '?pagename=interment&InterID='. $rsSameLot['InterID'];
	    //$redirect = get_site_url(null, $link);
	    $redirect = esc_html( add_query_arg( 'InterID', $rsSameLot['InterID'], get_permalink(get_option('cemetery-sexton')['page_interment']) ) );
	    ?>
		<tr>
			<td class="result-name"><a href="<?php echo $redirect; ?>"><?php echo $rsSameLot['FirstName'].' '.$rsSameLot['MidName'].' '.$rsSameLot['LastName'].' '.$rsSameLot['Suffix']; ?></a></td>
			<td class="result-date"><a href="<?php echo $redirect; ?>"><?php echo $tools->tools_dateFormat($rsSameLot['DateBirth']); ?></a></td>
			<td class="result-date"><a href="<?php echo $redirect; ?>"><?php echo $tools->tools_dateFormat($rsSameLot['DateDeath']); ?></a></td>
		</tr>
		<?php }	?>
	</tbody>
</table>
</div>