<?php
/**
 * Intranet
 *
 * PHP version 5
 *
 * @category  PHP
 * @package   Rocket_form
 * @author    Softdiscover <info@softdiscover.com>
 * @copyright 2015 Softdiscover
 * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
 * @link      https://softdiscover.com/zigaform/wordpress-cost-estimator
 */
if ( ! defined('BASEPATH')) {
    exit('No direct script access allowed');
}
?>
<div id="uiform-container" class="uiform-wrap uiform-page_records">
    <input type="hidden" id="rec_id" value="<?php echo $record_id; ?>">
      
    <div id="uiform-inforecord-container">
         <div class="space20"></div>
    <div class="sfdc-row">
        <div class="sfdc-col-md-8">

            <?php if (isset($fmb_rec_tpl_st) && intval($fmb_rec_tpl_st) === 0) { ?>  
            <div class="uifm-inforecord-box-info sfdc-clearfix">
                <h1><?php echo $form_name; ?></h1>
                <h4 class="zgfm-no-margin zgfm-margin-bottom-20"><?php echo __('Submitted form data', 'FRocket_admin'); ?></h4>
                <ul>
                <?php
                foreach ($record_info as $value) {
                    ?>
                    <?php if (is_array($value['value'])) { ?>   
                 <li><b><?php echo $value['field']; ?></b> 
                     <ul>
                         <?php
                         
                            if(isset($value['value']['qty']) || isset($value['value']['label'])){
                                ?>
                                <li>
                                       <?php
        
                                       if (isset($value['value']['qty']) && floatval($value['value']['qty']) > 0) {
                                           echo  $value['value']['qty'] . ' ' . __('Units', 'FRocket_admin');
                                       }elseif (isset($value['value']['label']) ) {
                                            echo  $value['value']['label'];
                                       }
       
                                       
                                       ?>
                                   
                                </li>
                               
                               
                               <?php
                            }else{
                                foreach ($value['value'] as $key2 => $value2) {
                                    ?>
                             <li>
                                    <?php
    
                                    echo $value2['label']??'';
                                    if (isset($value2['qty']) && floatval($value2['qty']) > 0) {
                                        echo ' - ' . $value2['qty'] . ' ' . __('Units', 'FRocket_admin') ;
                                    }
     
                                    ?>
                                
                             </li>
                            
                            
                            <?php
                            }
                            
                            } ?>
                     </ul>
                 </li>
                    <?php } else { ?>
                        <li>
                            <b><?php echo $value['field']; ?></b> :
                            <?php 
                                if (strpos($value['value'], "^,^") !== false) {
                                    // Explode the string by "^,^" delimiter
                                    $options = explode("^,^", $value['value']);
                                    echo "<ul class='records-option-list'>";
                                    foreach ($options as $option) {
                                        echo "<li><i class='fa fa-check-circle'></i> " . htmlspecialchars($option) . "</li>";
                                    }
                                    echo "</ul>";
                                } else {
                                    // If no "^,^", output the value directly
                                    echo htmlspecialchars($value['value']);
                                }
                            ?>
                        </li>
                    <?php } ?>
                      <?php
                }
                ?>
                  
                </ul>    
            </div>
                <?php
            } else {
                echo $custom_template;
            }
            ?>
            
        </div>
        <div class="sfdc-col-md-4">
            <div class="uifm-inforecord-box-info2">
                <h3><?php echo __('Additional info', 'FRocket_admin'); ?></h3>
                <ul >
                    <li>
                        <b><?php echo __('Date', 'FRocket_admin'); ?></b>:
                        <span><?php echo $info_date; ?></span>
                    </li>
                    <li>
                        <b><?php echo __('IP', 'FRocket_admin'); ?></b>:
                        <span><?php echo $info_ip; ?></span>
                    </li>
                    <li>
                        <b><?php echo __('Client PC info', 'FRocket_admin'); ?></b>:
                        <span ><?php echo $info_useragent; ?></span>
                    </li>
                    <li>
                        <b><?php echo __('URL page', 'FRocket_admin'); ?></b>:
                        <span><?php echo $info_referer; ?></span>
                    </li>
                    <li>
                        <b><?php echo __('Form name', 'FRocket_admin'); ?></b>:
                        <span><?php echo $form_name; ?></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    </div>
            
    <div class="space10"></div>
   <div class="sfdc-row">
       <div class="sfdc-col-md-12">
         <?php if (ZIGAFORM_F_LITE === 1) { ?>
       <a 
    onclick="javascript:rocketform.showFeatureLocked(this);"
                  data-blocked-feature="PDF export"
                   href="javascript:void(0);"
    class="sfdc-btn sfdc-btn-warning"><i class="fa fa-file-pdf-o"></i> <?php echo __('Export to PDF', 'FRocket_admin'); ?> <span class="rkfm-express-lock-wrap" 
                         ><i class="fa fa-lock"></i></span></a>
         <?php } else { ?>
            <a 
    href="javascript:void(0);"
    onclick="javascript:rocketform.genpdf_inforecord(<?php echo $record_id; ?>);"
    class="sfdc-btn sfdc-btn-warning"><i class="fa fa-file-pdf-o"></i> <?php echo __('Export to PDF', 'FRocket_admin'); ?></a>
         <?php } ?>   
            

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