# indicator is the field that is used to test for form submission
indicator: submit
auto_fieldset: 1
attributes:
 class: shopregister
model_config:
 resultset: Shopuser

elements:
 - type: Text
   name: firstname
   label: Firstname
   label_loc: Firstname 
   constraints:
    - Required

 - type: Text
   name: lastname
   label: Lastname
   label_loc: Lastname
   constraints:
    - Required

#  - type: Select
#    name: country_id
#    label: Country
#    label_loc: Country
#    empty_first: 1
#    empty_first_label_loc: Select country
#    model_config:
#      resultset: Country
#    constraints:
#     - Required
#     - type: Number

#  - type: Text
#    name: region
#    label: State
#    label_loc: State

 - type: Text
   name: town
   label: Town
   label_loc: Town
   constraints:
    - Required

 - type: Text
   name: address
   label: Address
   label_loc: Address
   constraints:
    - Required

 - type: Text
   name: postal_code
   label: Postal code
   label_loc: Postal code
   constraints:
    - Required
    - type: Number

 - type: Text
   name: phone
   label: Phone
   label_loc: Phone
   constraints:
    - Required
    - type: Regex
      regex: '\d+[0-9\s]+'

 - type: Text
   name: email
   label: E-mail
   label_loc: E-mail
   constraints:
    - Required
    - Email
    - type: Equal
      others: repeat_email
      message_loc: 'Email does not match'
   validator: 'Cms::ShopuserEmailValidator'

 - type: Text
   name: repeat_email
   label: Repeat email
   label_loc: Repeat email
   constraints:
    - Required

 - type: Password
   name: password
   label: Password
   label_loc: Password
   constraints:
    - Required
    - type: Equal
      others: repeat_password
      message_loc: 'Password does not match'

 - type: Password
   name: repeat_password
   label: Repeat password
   label_loc: Repeat password
   constraints:
    - Required

 - type: Checkbox
   name: newsletter
   label: Newsletter
   label_loc: 'Subscribe to our Newsletter'

 - type: Checkbox
   name: accept_rules
   label: 'Accept rules'
   label_loc: 'I have read and accept the general conditions'
   constraints:
    - Required
   comment_loc: '<a target="_blank" href="">View general conditions</a>'
   add_comment_attrs:
     class: 'comments-attrs'

#  - type: reCAPTCHA
#    label: 'ReCaptcha'
#    label_loc: 'ReCaptcha'
#    name: recaptcha
#    public_key: '6LewesgSAAAAACWik1lzmYmC0ukD8e98ErTs3tUO'
#    private_key: '6LewesgSAAAAAJNvZPBWW18UH-ZlNLuacUo0ifXJ'
#    constraint_args:
#      message_loc: 'The ReCaptcha is incorrect'
#    recaptcha_options:
#      lang: es
#      theme: clean
     
# The Submit button
 - type: Submit
   name: submit
   # The text to be displayed
   value: Send
   value_loc: SEND

