extends layout


block content
  .container
    h1 Settings, logged in as: #{user}
    if admin == true
      br
      .card.shadow-lg
        center
          h4 here are your settings king
      br
      .card.shadow-lg
        h4 Add User
        form(method='POST', action='/admin/user')
          #form-group
            label Username:
            input.form-control(name='name', type='name')
            label Starting balance:
            input.form-control(name='init_bal', type='number')
            label Password:
            input.form-control(name='init_pass',type='password')
            label Confirm:
            input.form-control(name='password2',type='password')
          br
          input.btn.btn-primary(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Check User Balance 
        form(method='POST', action='/admin/baluser')
          #form-group
            label Username:
            input.form-control(name='name', type='name')
          br
          input.btn.btn-primary(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Change Balance of User
        form(method='POST', action='/admin/bal')
          #form-group
            label Username:
            input.form-control(name='name', type='name')
            label Set balance to:
            input.form-control(name='amount', type='number')
          br
          input.btn.btn-primary(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Delete user
        p This will permanently delete user make sure you get it right
        form(method='POST', action='/admin/userdelete')
          #form-group
            label Username:
            input.form-control(name='name', type='name')
            label Confirm Admin Password:
            input.form-control(name='attempt', type='password')
          br
          input.btn.btn-primary(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Change backend URL
        form(method='POST', action='/admin/changebackend')
          #form-group
            p WARNING DO NOT PUT WRONG URL IN YOU WILL BREAK AND HAVE TO DELETE .ENV FILE TO FIX
            p This will change the backend that is being used by the front end
            label Enter URL of new BankAPI including trailing slash
            input.form-control(name='url', type='url')
          br
          input.btn.btn-warning(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Change backend  Mongodb URL
        form(method='POST', action='/admin/mongodb')
          #form-group
            p WARNING DO NOT PUT WRONG URL IN YOU WILL BREAK AND HAVE TO DELETE .ENV FILE TO FIX
            label Enter URL of new MongoDB or enter a space to turn off marketplace
            input.form-control(name='url', type='text')
          br
          input.btn.btn-warning(type='submit',value='Submit')
      br
      .card.shadow-lg
        h4 Destroy All Sessions
        form(method='POST', action='/admin/destroyallsessions')
          #form-group
            p WARNING THIS WILL DESTROY ALL LOGIN SESSIONS, EVERYONE WILL HAVE TO LOG IN AGAIN
            label Confirm admin password to DESTROY
            input.form-control(name='attempt', type='password')
          br
          input.btn.btn-danger(type='submit',value='Destroy')
      br
      .card.shadow-lg
        h4 Close Server
        form(method='POST', action='/admin/close')
          #form-group
            p WARNING THIS WILL CLOSE THE SERVER DOWN, IT WILL REQUIRE MANUAL RESTART
            label Confirm admin password to shutdown
            input.form-control(name='attempt', type='password')
          br
          input.btn.btn-danger(type='submit',value='Shutdown')
