<?php

$currentPageID = CONST_RESUME_PAGE_ID;

$profileResumeTitle = array();

$outter = 0;
if(have_rows('profile_resume',$currentPageID)){
    while(have_rows('profile_resume',$currentPageID)){
        the_row();      

        $profileResumeTitle[] = get_sub_field('profile_resume_title',$currentPageID);

        $profileEducationYear[$outter] = array();
        $profileEducationCompany[$outter] = array();
        $profileEducationDesignation[$outter] = array();
        $profileEducationDescription[$outter] = array();

        if(have_rows('profile_education',$currentPageID)){
            while(have_rows('profile_education',$currentPageID)){
                the_row();  

                $profileEducationYear[$outter][] = get_sub_field('profile_education_year',$currentPageID);
                $profileEducationCompany[$outter][] = get_sub_field('profile_education_company',$currentPageID);
                $profileEducationDesignation[$outter][] = get_sub_field('profile_education_designation',$currentPageID);
                $profileEducationDescription[$outter][] = get_sub_field('profile_education_description',$currentPageID);

            }
        }        
        $outter++;
    }
}

$profileSkillsHeading = array();
$profileSkillsContent = array();

$outter = 0;
if(have_rows('profile_skills',$currentPageID)){
    while(have_rows('profile_skills',$currentPageID)){
        the_row();      

        $profileSkillsHeading[] = get_sub_field('profile_skills_heading',$currentPageID);
        $profileSkillsContent[] = get_sub_field('profile_skills_content',$currentPageID);

        // $profileSkillsLabel[$outter] = array();
        // $profileSkillsValue[$outter] = array();

        // if(have_rows('profile_skills_details',$currentPageID)){
        //     while(have_rows('profile_skills_details',$currentPageID)){
        //         the_row();  

        //         $profileSkillsLabel[$outter][] = get_sub_field('profile_skills_label',$currentPageID);
        //         $profileSkillsValue[$outter][] = get_sub_field('profile_skills_value',$currentPageID);

        //     }
        // }        
        $outter++;
    }
}

$profileKnowledgeHeading = get_field('profile_knowledge_heading',$currentPageID);

$profileKnowledgesLabel = array();

if(have_rows('profile_knowledges',$currentPageID)){
    while(have_rows('profile_knowledges',$currentPageID)){
        the_row();      

        $profileKnowledgesLabel[] = get_sub_field('profile_knowledges_label',$currentPageID);

    }
}

?>

<div class="row">
    <div class="col-xs-12 col-sm-7">

        <?php
            for($outter=0; $outter < sizeof($profileResumeTitle); $outter++ )
            {
        ?>
                <div class="block-title">
                    <!-- <h3><?php echo($profileResumeTitle[$outter]); ?></h3> -->
                    <?php 
                        $tempArray = explode(",",$profileResumeTitle[$outter]);
                        if(sizeof($tempArray) > 1 ){
                    ?>
                            <h3><?php echo($tempArray[0]); ?> <span><?php echo($tempArray[1]); ?></span></h3>
                    <?php
                        }
                        else{
                    ?>
                            <h3><?php echo($tempArray[0]); ?></h3>
                    <?php
                        }
                    ?>
                </div>
                
                <div class="timeline timeline-second-style clearfix">

                    <?php
                        for($counter=0; $counter < sizeof($profileEducationYear[$outter]); $counter++ )
                        {
                    ?>
                        <div class="timeline-item clearfix">
                          <div class="left-part">
                            <h5 class="item-period"><?php echo($profileEducationYear[$outter][$counter]); ?></h5>
                            <span class="item-company"><?php echo($profileEducationCompany[$outter][$counter]); ?></span>
                          </div>
                          <div class="divider"></div>
                          <div class="right-part">
                            <h4 class="item-title"><?php echo($profileEducationDesignation[$outter][$counter]); ?></h4>
                            <?php echo($profileEducationDescription[$outter][$counter]); ?>
                          </div>
                        </div>
                    
                    <?php 
                        }                   
                        if($outter > 0 ){
                    ?>
                            <div class="white-space-50"></div>
                    <?php
                        }
                    ?>                                              
                </div>
                <?php                    
                    if($outter > 0 ){
                ?>
                        <div class="white-space-50"></div>
                <?php
                    }
                }
            ?>
    </div>

    <!-- Skills & Certificates -->
    <div class="col-xs-12 col-sm-5">
        <?php
            for($outter=0; $outter < sizeof($profileSkillsHeading); $outter++ )
            {
        ?>
                <!-- Design Skills -->
                <div class="block-title">
                    <!-- <h3>Design <span>Skills</span></h3> -->
                    <h3><?php echo($profileSkillsHeading[$outter]); ?></h3>
                </div>

                <div class="skills-info skills-second-style">
                    <?php echo($profileSkillsContent[$outter]); ?>
                </div>
                <!-- End of Design Skills -->

        <?php                    
                if($outter > 0 ){
        ?>
                    <div class="white-space-50"></div>
            <?php
                }
        
            }

            if(sizeof($profileKnowledgesLabel) > 0 ){
        ?>

            <div class="white-space-10"></div>

            <!-- Knowledges -->
            <div class="block-title">
                <h3><?php echo($profileKnowledgeHeading); ?></h3>
            </div>

            <ul class="knowledges">
                <?php
                    for($counter=0; $counter < sizeof($profileKnowledgesLabel); $counter++ )
                    {
                ?>
                        <li><?php echo($profileKnowledgesLabel[$counter]); ?></li>
                <?php
                    }
                ?>            
            </ul>
            <!-- End of Knowledges -->

        <?php
            }
        ?>
        
    </div>
    <!-- End of Skills & Certificates -->
</div>