extends ./admin-layout.jade
include ./includes/mixins.jade


block jumbo-desc
    p Edit User Details


block admin-content
    - var route = "/admin/users/" + user.id;

    h3 Username: #{user.username} <br>

    form(action=route + "/edit-details" enctype="multipart/form-data" method="post")
        +input_text("fname", "First Name", "", true, user.fname)
        +input_text("lname", "Last Name", "", true,  user.lname)
        +input_text("email", "Email ", "", true, user.email)

        if ( roles )
            .form-group
                label.control-label(for="role") Role
                select.form-control(name="role")
                    each role in roles
                        - var formattedRole = _.startCase( role.toLowerCase() );
                        - var sel = ( role === user.roleName() );
                        option(value=role, selected=sel) #{formattedRole}

        if ( agencies )
            .form-group
                label.control-label( for="agency" ) Agency
                select.form-control( name="agency" )
                    each agency in agencies
                        if ( agency.id === user.agency )
                            option( value=agency.id selected ) #{agency.name}
                        else
                            option( value=agency.id ) #{agency.name}


        +input_text("badge", "Badge No.", "", true,  user.badge)
        +input_text("sectunit", "Section / Unit", "", true, user.sectunit)
        +input_text("ranktitle", "Rank / Title", "", true, user.ranktitle)

        .form-group
            button.btn.btn-primary(type="submit" value="save") Submit
