<?php
/**
 * YAWIK
 *
 * @filesource
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
 * @license   MIT
 * @author fedys
 */

$container = $this->element; /* @var $container \Core\Form\Container */
$this->formCollectionContainer()->setDisplayRemoveButton(false);
?>
<div class="row">
    <div class="col-md-8">
        <?=$this->summaryForm($container->getForm('contact'))?>
    </div>
    <div class="col-md-4">
        <h3><?php echo $this->translate('Image') ?></h3>
        <?=$this->form($container->getForm('image'))?>
    </div>
</div>
<div>
    <h3><?=$this->translate('Desired Employment')?></h3>
    <?=$this->summaryForm($container->getForm('preferredJob'))?>
</div>
<div>
     <?=$this->formCollectionContainer($container->getForm('employments'))?>
</div>
<div>
     <?=$this->formCollectionContainer($container->getForm('educations'))?>
</div>

<div>
    <h3><?=$this->translate('Native Language')?></h3>
    <?=$this->summaryForm($container->getForm('nativeLanguage'))?>
</div>

<div>
    <?=$this->formCollectionContainer($container->getForm('languageSkills'))?>
</div>

<div>
    <?=$this->form($container->getForm('attachments'))?>
</div>

<div>
     <?php # echo $this->formCollectionContainer($container->getForm('skills'))?>
</div>
<script type="text/javascript">
    function formatState (level) {
        var $level = $(
            '<div>' + level.id + '</div><div>' + level.text + '</div>'
        );
        console.debug( level );
        return $level;
    }
    console.debug( $("#skill-languageSkills-0-levelReading"));
    $("#skill-languageSkills-0-levelReading").select2({
        templateResult: formatState,
        templateSelection: formatState,
        theme:"bootstrap",
        width: 'resolve'
    });
    $(document).on('click', 'input[name$="[currentIndicator]"]', function () {
        var $checkbox = $(this),
        	$form = $checkbox.closest('form'),
        	$endDateFormGroup = $form.find('input[name$="[endDate]"]')
        		.closest('.form-group');
        $endDateFormGroup.toggleClass('hidden', $checkbox.prop('checked'));
    });

</script>