<style>
    .form-group {
        max-width: 271px;
</style>

{capture name=path}
    <a style="padding-right: 40px;" href="{$link->getPageLink('my-account', true)|escape:'html'}" title="Mon compte" rel="nofollow">Mon compte</a>
    <a href="{$link->getModuleLink('myvetshopclinique', 'myanimals', [], true)|escape:'html'}" title="Mes animaux" rel="nofollow">Mes animaux</a>
    <span class="navigation-pipe">{$navigationPipe}</span>
    Ajouter un animal
{/capture}

<div class="row">
    <div id="center_column" class="center_column col-xs-12 col-sm-12">
        {if isset($animal)}
            <h1 class="page-heading">
                {if $animal->id}
                    Modifier un animal
                {else}
                    Ajouter un animal
                {/if}
            </h1>
        {/if}

        {if isset($success) && $success }
            <div class="alert alert-success" role="alert">
                {$success}
            </div>
        {/if}

        {if isset($error) && $error }
            <div class="alert alert-danger" role="alert">
                {$error}
            </div>
        {/if}

        {if isset($animal)}
            <form method="post" action="{$link->getModuleLink('myvetshopclinique', 'myanimal', [], true)|escape:'html'}">
                <div class="block-center">
                    <div class="box">

                            {if $animal->id}
                                <h1 class="page-subheading">{$animal->nom}</h1>
                            {/if}

                            <p> *Champ requis <br><br></p>
                            <div class="form-group">
                                <label for="animalName">Nom*</label>
                                <input type="text" class="form-control" id="animalName" name="nom" required value="{$animal->nom}">
                            </div>

                            <div class="form-group">
                                <label for="animalGender">Genre*</label>
                                <select class="form-control" id="animalGender" name="id_gender" required>
                                    <option {if $animal->id_gender == 1 }selected{/if} value="1">Mâle</option>
                                    <option {if $animal->id_gender == 2 }selected{/if} value="2">Femelle</option>
                                </select>
                            </div>

                            <div class="form-group">
                                <label for="animalBirth">Date de naissance</label>
                                <input type="date" class="form-control" id="animalBirth" name="date_naissance" value="{$animal->date_naissance}">
                            </div>


                            <div class="form-group">
                                <label for="animalSpecies">Espèce*</label>
                                <select class="form-control" id="animalSpecies" name="espece" required>
                                    <option {if $animal->espece === 'chien'}selected{/if} value="chien">Chien</option>
                                    <option {if $animal->espece === 'chat'}selected{/if} value="chat">Chat</option>
                                </select>
                            </div>

                            <div class="form-group">
                                <label for="animalBreed">Race</label>
                                <input type="text" class="form-control" id="animalBreed" name="race" value="{$animal->race}">
                            </div>


                            <div class="form-group">
                                <label for="animalColor">Robe</label>
                                <input type="text" class="form-control" id="animalColor" name="robe" value="{$animal->robe}">
                            </div>


                            <div class="form-group">
                                <label for="animalRation">Ration (g/jour)</label>
                                <input type="number" class="form-control" id="animalRation" name="ration" value="{$animal->ration}" min="0">
                            </div>


                            {if $animal->id}
                                <input type="hidden" name="action" value="update">
                                <input type="hidden" name="id" value="{$animal->id}">
                            {else}
                                <input type="hidden" name="action" value="create">
                            {/if}

                    </div>
                </div>
                {if $animal->id}
                    <button type="submit" class="btn btn-default button button-medium"><span> Modifier <i class="icon-chevron-right right"></i> </span></button>
                {else}
                    <button type="submit" class="btn btn-default button button-medium"><span> Ajouter <i class="icon-chevron-right right"></i> </span></button>
                {/if}
            </form>
        {/if}

    </div>
</div>
