<div class="handler">
 {statement::display()}
    <div class="lap p5">
        Dodawanie użytkownika
    </div>
    <script type="text/javascript">
    $(document).on('change','[name=umode]',function(){
        if( $(this).val() == 'user' )
        {
            $('#SelectTherapist').show();
        } 
        else 
        {
            $('#SelectTherapist').hide(); 
        }
    });
    </script>  
    <form method="post">
        <table class="table">
            <tbody>
                <tr>
                    <td class="typeName">Uprawnienia</td>
                    <td><select class="form-control" name="umode">
                        <option value="">- wybierz -</option>
                        <option value="user">Decydent</option>
                        <option value="admin"{if $data.mode=='admin'} selected="selected"{/if}>Administrator</option>
                        <option value="therapist"{if $data.mode=='therapist'} selected="selected"{/if}>Terapeuta</option>
                    </select></td>
                </tr>
            </tbody>
            <tbody>
                <tr>
                    <td class="typeName">Imię</td>
                    <td><input type="text" class="form-control" name="firstname" value="{$data['firstname']}" /></td>
                </tr>
            </tbody>
            <tbody>
                <tr>
                    <td class="typeName">Nazwisko</td>
                    <td><input type="text" class="form-control" name="lastname" value="{$data['lastname']}" /></td>
                </tr>
            </tbody>
            <tbody id="SelectTherapist"{if $data['mode']!='user'} class="none"{/if}>
                <tr>
                    <td class="typeName">Przydzielony terapeuta</td>
                    <td>
                        <select name="therapist" class="form-control">
                            <option value="">- wybierz -</option>
                            {foreach from=$TherapistList->Items item=$Therapist}
                            <option value="{$Therapist->id}"{if $Therapist->id==$data['therapist']} selected="true"{/if}>{$Therapist->fullname}</option>
                            {/foreach}
                        </select>
                    </td>
                </tr>
            </tbody> 
            <tbody>
                <tr>
                    <td class="typeName">Email</td>
                    <td><input type="text" class="form-control" name="email" value="{$data.email}" /></td>
                </tr>
            </tbody>

            <tbody id="password">
                <tr>
                    <td class="typeName">Hasło</td>
                    <td><input class="form-control" type="password" name="pass" /></td>
                </tr>
                <tr>
                    <td class="typeName">Powtórz hasło</td>
                    <td><input class="form-control" type="password" name="repass" /></td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2"><input class="btn btn-primary" type="submit" value="Zapisz" /></td>
                </tr>
            </tfoot>
        </table>
    </form>
</div>