@(field: play.api.data.Field, hintText: Option[String] = None, args: Map[Symbol, Any])(implicit handler: helper.FieldConstructor, lang: Lang)

@import uk.gov.dvla.vehicles.presentation.common.views
@import views.constraints.Required.RequiredField
@import play.api.templates.PlayMagic.toHtmlArgs
@import views.helpers.HtmlArgsExtensions.RichHtmlArgs
@import views.html.widgets.base.valtechLabel
@import _root_.views.html.helper.input
@import views.html.widgets.base.hintTextSnippet

@input(field, args.toSeq:_* ) { (id, name, value, htmlArgs) =>
    @valtechLabel(field,args)

    <input type="tel"
        id="@id"
        name="@name"
        pattern="[0-9]{1,20}"
        title="Must be numbers only" @* TODO move this value into a constant *@
        value="@value"
        @{if(field.constraints.find(_._1 == RequiredField)) "aria-required=true" else ""} @* TODO move this into an extension method and write unit tests *@
        @{if(field.hasErrors) "aria-invalid=true" else ""} @* TODO move this into an extension method and write unit tests *@
        @toHtmlArgs(htmlArgs.withMaxLength.withoutAutoComplete.withAriaDescribedby(hintText, id))
    >

    @hintTextSnippet(hintText, idOfRelatedInput = id)
}

@(field: play.api.data.Field, hintText: Option[String] = None, args: Map[Symbol, Any])(implicit handler: helper.FieldConstructor, lang: Lang)

@import uk.gov.dvla.vehicles.presentation.common.views
@import views.constraints.Required.RequiredField
@import play.api.templates.PlayMagic.toHtmlArgs
@import views.helpers.HtmlArgsExtensions.RichHtmlArgs
@import views.html.widgets.base.valtechLabel
@import _root_.views.html.helper.input
@import views.html.widgets.base.hintTextSnippet

@input(field, args.toSeq:_* ) { (id, name, value, htmlArgs) =>
    @valtechLabel(field,args)

    <input type="tel"
        id="@id"
        name="@name"
        pattern="[0-9]{1,20}"
        title="Must be numbers only" @* TODO move this value into a constant *@
        value="@value"
        @{if(field.constraints.find(_._1 == RequiredField)) "aria-required=true" else ""} @* TODO move this into an extension method and write unit tests *@
        @{if(field.hasErrors) "aria-invalid=true" else ""} @* TODO move this into an extension method and write unit tests *@
        @toHtmlArgs(htmlArgs.withMaxLength.withoutAutoComplete.withAriaDescribedby(hintText, id).withTypeAttribute)
    >

    @hintTextSnippet(hintText, idOfRelatedInput = id)
}

Revert "Revert "Pimp type attribute""
Revert "Revert "Pimp type attribute""

This reverts commit 852db21de90412cf0539e20bdeb07a09f9d4dc96.
