<?php if($mode!="create"): ?>
    <div class="form-group">
        <div class="col-md-3">
            <?php echo html()->label( 'N°&nbsp;','id'); ?>

            <?php echo html()->text('id', isset($enfant)?str_pad($enfant->id, 6, "0", STR_PAD_LEFT):'')
                ->attributes(['disabled', 'class' => 'form-control text-uppercase']); ?>

        </div>
    </div>
<?php endif; ?>

<div class='form-group row'>
    <div class="col-md-5">
        <?php echo html()->label( 'NOM','nom'); ?>

        <?php echo html()->text('nom', null)
        ->placeholder('Nom')
        ->attributes([($mode=="show"?'disabled':''), 'class' => 'form-control text-uppercase']); ?>

    </div>

    <div class="col-md-5">
        <?php echo html()->label( 'PRENOM','prenom'); ?>

        <?php echo html()->text('prenom', null)
            ->placeholder('Prénom')
            ->attributes([($mode=="show"?'disabled':''), 'class' => 'form-control']); ?>

    </div>

    <div class="col-md-2">
        <?php echo html()->label( 'Sexe','sexe'); ?>

        <?php echo html()->select('sexe', ['M'=>'Masculin','F' => 'Feminin'],null)
                ->placeholder('A définir')
                ->attributes([($mode=="show"?'disabled':''),'class' => 'form-control']); ?>

    </div>
</div>

<div class='form-group row'>
    <div class="col-md-2">
        <?php echo html()->label( 'Date de naissance','datenais'); ?>

            <div class='input-group date' id='datepicker_datenais'>
                <?php echo html()->text('datenais', null)
                    ->placeholder('Date de naissance')
                    ->attributes([($mode=="show"?'disabled':''),'class' => 'form-control']); ?>

                <span class='input-group-addon'><span class='glyphicon glyphicon-calendar'></span></span>
            </div>
    </div>

    <div class="col-md-2">
        <?php echo html()->label( 'Certificat','certif'); ?>

        <?php echo html()->select('certif', ['0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '9' => '9'],null)
            ->placeholder('A définir')
            ->attributes([($mode=="show"?'disabled':''),'class' => 'form-control']); ?>

    </div>

    <div class="col-md-4">
        <?php echo html()->label( 'Verrou','verrou'); ?><br/>
        <?php echo html()->checkbox('verrou', null,1)->attributes([($mode=="show"?'disabled':''),'class' => '']); ?>

    </div>
</div>

<div class="callout callout-success">
    <div class='form-group row '>
        <legend class="h2"><small>Responsable parental</small></legend>
        <div class="col-md-5">
            <?php echo html()->label( 'Responsable','parents1'); ?>

            <?php echo html()->hidden('parents1', (($beneficiaire)?$beneficiaire->id:null))->attributes(['id' => 'parents1']); ?>

            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text" id='parents1_addon'><?php echo isset($enfant)?$enfant->parents1:''; ?></span>
                </div>
                <?php echo html()->text('responsable',((isset($beneficiaire)&&$beneficiaire)?$beneficiaire->nom_complet:(isset($enfant)?$enfant->NomParent1:'')))
                    ->placeholder("Responsable")
                    ->attributes([($mode=="show"?'disabled':''), 'id'=>'responsable','class' => 'form-control', (isset($beneficiaire)&&$beneficiaire)?'readonly':'']); ?>

            </div>
        </div>
        <!--
        <div class="col-md-5">
            <?php echo html()->label( 'Compte bancaire','compte_p'); ?>

            <?php echo html()->text('compte_p', null)->placeholder('Compte bancaire')->attributes([($mode=="show"?'disabled':''), 'class' => 'form-control']); ?>

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


<div class="callout callout-warning">
    <div class='form-group row'>
        <legend class="h2"><small>Conjoint</small></legend>
        <div class="col-md-5">
            <?php echo html()->label( 'Réf.','parents2'); ?>

            <?php echo html()->hidden('parents2', null)->attributes(['id' => 'parents2']); ?>

            <div class="input-group mb-3">
                <div class="input-group-prepend">
                    <span class="input-group-text" id='parents2_addon'><?php echo isset($enfant)?$enfant->parents2:''; ?></span>
                </div>
                <?php echo html()->text('conjoint',isset($enfant)?$enfant->NomParent2:'')
                    ->placeholder("Conjoint")
                    ->attributes([($mode=="show"?'disabled':''), 'id'=>'conjoint','class' => 'form-control']); ?>

            </div>
        </div>
        <!--
        <div class="col-md-5">
            <?php echo html()->label( 'Compte bancaire','compte_m'); ?>

            <?php echo html()->text('compte_m', null)->placeholder('Compte bancaire')->attributes([($mode=="show"?'disabled':''), 'class' => 'form-control']); ?>

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

<div class='form-group row'>
    <div class="col-md-12" >
    <?php echo html()->label('Observations','obs',); ?>

    <?php echo html()->textarea('obs', null)->attributes([($mode=="show"?'disabled':''), 'class' => 'form-control', 'rows'=>'3']); ?>

    </div>
</div>

<div class='form-group'>
    <?php if($mode=="show"): ?>
        <?php if($user->hasRole("ADMINISTRATEUR") || $user->can("ENF_MAJ")): ?>
            <?php if($beneficiaire): ?>
                <a class="btn btn-primary" href="<?php echo url('enfants_edit_avec_benef/'.$enfant->id.'/'.$beneficiaire->id."?benef_type=".$benef_type); ?>">Modifier</a>
            <?php else: ?>
                <a class="btn btn-primary" href="<?php echo url('enfants/'.$enfant->id."/edit?benef_type=".$benef_type); ?>">Modifier</a>
            <?php endif; ?>
            <?php if($enfant->canDelete): ?>
                <?php echo e(html()->form('DELETE', url('/enfants/'. $enfant->id."?benef_type=".$benef_type))->open()); ?>

                    <button class="btn btn-danger btn-sm"><span class='fas fa-trash'></span></button>
                <?php echo e(html()->form()->close()); ?>

            <?php endif; ?>
        <?php endif; ?>
    <?php else: ?>
        <?php echo html()->button('Enregistrer')->value('Enregistrer')->type('submit')->attributes(['class' => 'btn btn-primary']); ?>

    <?php endif; ?>
    <?php if(!$beneficiaire): ?>
        <a class="btn btn-warning"  href="<?php echo url('enfants_liste/'.$benef_type); ?>">Retour</a>
    <?php endif; ?>
</div>
<?php /**PATH C:\xampp\htdocs\SYSINFO\cpswf\sipre2\resources\views/tiers/enfants/content.blade.php ENDPATH**/ ?>