<?php
/**
 *
 * @package ESIG_FORMINATOR_DOCUMENT_VIEW
 * @author  Abu Shoaib <abushoaib73@gmail.com>
 */



if (! class_exists('esigForminatorDocumentView')):
class esigForminatorDocumentView {
    
    
            /**
        	 * Initialize the plugin by loading admin scripts & styles and adding a
        	 * settings page and menu.
        	 * @since     0.1
        	 */
        	final function __construct() {
                        
        	}
        	
        	/**
        	 *  This is add document view which is used to load content in 
        	 *  esig view document page
        	 *  @since 1.1.0
        	 */
        	
        	final function add_document_view()
        	{
        	    
        	    if(!function_exists('WP_E_Sig'))
                                return ;
                    
                    
							
                    
        	    
        	    //$api = WP_E_Sig();
        	    $assets_dir = ESIGN_ASSETS_DIR_URI;
			
			//	$test = Forminator_API::get_form();

				if(!class_exists('Forminator_GFBlock_Forms'))
				return ;
				
				$getAllForm = Forminator_GFBlock_Forms::get_instance()->get_forms();
				
                    
        	   $more_option_page = ''; 
        	   
        	    
        	    $more_option_page .= '<div id="esig-forminator-option" class="esign-form-panel" style="display:none;">
        	        
        	        
                	               <div align="center"><img src="' . $assets_dir .'/images/logo.png" width="200px" height="45px" alt="Sign Documents using WP E-Signature" width="100%" style="text-align:center;"></div>
                    			
                                    
                    				<div id="esig-forminator-form-first-step">
                        				
                                        	<div align="center" class="esig-popup-header esign-form-header">'.__('What Are You Trying To Do?', 'esig').'</div>
                                            	
                        				<p id="create_forminator" align="center">';
                                	    
                                	    $more_option_page .=	'
                        			
                        				<p id="select-forminator-form-list" align="center">
                                	    
                        		        <select data-placeholder="Choose a Option..." class="chosen-select" tabindex="2" id="esig-forminator-form-id" name="esig_forminator_form_id">';
                                	  
                                           
                                            if(!empty($getAllForm)){
                                            
												foreach($getAllForm as $value)
												{

													if($value['label'] == 'Select a form'){
														$value['label'] = 'Select a Forminator';
													}
												
												
													$more_option_page .=	'<option value="'. $value['value'] . '">'.$value['label'] .'</option>';
												}
                                            }
                                            
                            	         
                                                        
                                            
                                	    $more_option_page .='</select>
                                	    
                        				</p>
                         	  
                                	    </p>
                                	    
                                        <p id="upload_forminator_button" align="center">
                                           <a href="#" id="esig-forminator-create" class="button-primary esig-button-large">'.__('Next Step', 'esig').'</a>
                                         </p>
                                     
                                    </div>  <!-- Frist step end here  --> ';
                            
                                    
                 $more_option_page .='<!-- Forminator form second step start here -->
                                            <div id="esig-forminator-second-step" style="display:none;">
                                            
                                        	<div align="center" class="esig-popup-header esign-form-header">'.__('What Forminator field data would you like to insert?', 'esig').'</div>
                                            
                                            <p id="esig-forminator-field-option" align="center">
                               



                                             </p>
                                            
                                             <p id="select-forminator-field-display-type" align="center">
                                	    
                        		        <select data-placeholder="Choose a Option..." class="chosen-select" tabindex="2" id="esig-forminator-form-id" name="esig_forminator_value_display_type">
                        			     <option value="value">'.__('Select a display type', 'esig').'</option>
                                          
                                         
                                           <option value="value">'.__('Display value', 'esig').'</option>
                                           <option value="label_value">'.__('Display label + value', 'esig').'</option>
										   <option value="label">'.__('Display label', 'esig').'</option>';
                                	   
                                           
                                	    $more_option_page .='</select>
                                	    
                        				</p>
                                             <p id="upload_forminator_button" align="center">
                                           <a href="#" id="esig-forminator-insert" class="button-primary esig-button-large">'.__('Add to Document', 'esig').'</a>
                                         </p>
                                            
                                            </div>
                                    <!-- forminator form second step end here -->';           
                                    
                                    
        	    
        	    $more_option_page .= '</div><!--- forminator option end here -->' ;
        	    
        	    
        	    return $more_option_page ; 
        	}
        	
        	
	   
    }
endif ; 

