No Description

addItem.html 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {% extends 'header.html' %}
  2. {% block css %}
  3. <link rel='stylesheet' href='/static/css/tienda.css'>
  4. {% endblock %}
  5. {% block body %}
  6. <div class='container-fluid'>
  7. <div class='row'>
  8. <div class='col-3'></div>
  9. <div class=col-6 style=' background-color: rgba(219, 226,230, 0.6);'>
  10. <form action='/addItem' method='POST' enctype="multipart/form-data"><br>
  11. Nombre: <input type="text" name='nombre' class="form-control" placeholder="Nombre de {{link}}">
  12. <div class='form-row align-items-center'>
  13. <div class='col-6'>
  14. Categoría:
  15. <select class="form-control" id="selectCat" onchange='change("selectCat")' name='categoria'>
  16. {% for categoria in categorias %}
  17. <option value={{categoria.categoria}}>{{categoria.categoria}}</option>
  18. {% endfor %}
  19. <option value='0'>Nueva categoría</option>
  20. </select>
  21. </div>
  22. <div class='col-6'>
  23. Precio:
  24. <div class="input-group mb-2 mr-sm-2">
  25. <div class="input-group-prepend">
  26. <div class="input-group-text">$</div>
  27. </div>
  28. <input type="text" class="form-control" id="inlineFormInputGroupUsername2" name='Precio'
  29. placeholder="Precio">
  30. </div>
  31. </div>
  32. </div>
  33. <div id='categoria'>
  34. Nueva Categoría : <input type='text' name='nuevaCategoria' class='form-control' id='nuevaCategoria'>
  35. </div>
  36. Descripción: <textarea class="form-control" name='descripcion' rows="5" id="comment"></textarea>
  37. Imagen:
  38. <div class="custom-file">
  39. <input type="file" class="custom-file-input" name='imagen' id="imagen" lang="en"
  40. onchange='changePlaceHolder()'>
  41. <label class="custom-file-label" id='placeholder' for="customFileLang">Choose file</label>
  42. </div>
  43. Tipo de Item:
  44. <div class="form-check">
  45. <input class="form-check-input" type="radio" name="tipoDeItem" id="exampleRadios1" value="0">
  46. <label class="form-check-label" for="exampleRadios1">
  47. Comida
  48. </label>
  49. </div>
  50. <div class="form-check">
  51. <input class="form-check-input" type="radio" name="tipoDeItem" id="exampleRadios2" value="1">
  52. <label class="form-check-label" for="exampleRadios2">
  53. Bebida
  54. </label>
  55. </div>
  56. <button type='submit' class='btn btn-primary'>Someter</button>
  57. </form>
  58. </div>
  59. </div>
  60. </div>
  61. <script>
  62. $(document).ready(function () {
  63. $('#categoria').hide()
  64. });
  65. function change(string) {
  66. if ($('#' + string).val() == 0) {
  67. $('#categoria').show();
  68. }
  69. else {
  70. $('#categoria').hide();
  71. }
  72. }
  73. function changePlaceHolder() {
  74. var val = $('#imagen').val();
  75. $('#placeholder').html(val);
  76. }
  77. </script>
  78. {% endblock %}