 <%- include('partials/_header'); %>
 <style>
    .status-indicator {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 4px;
      vertical-align: middle;
    }

    .status-vigente {
      background-color: rgb(21, 162, 21);
    }

    .status-anulada {
      background-color: rgb(177, 15, 3);
    }


    .status-siniestro {
      background-color: rgb(139, 10, 141);
    }

    .status-deuda {
      background-color: rgb(237, 66, 80);
    }
  </style>


  <script type="text/javascript">
    window.onload = function () {


      
      var fecha = new Date(document.getElementById("fechatextdesde").value);

      var mes = fecha.getUTCMonth() + 1;
      var dia = fecha.getUTCDate();
      var ano = fecha.getUTCFullYear();  



      if (dia < 10)
        dia = '0' + dia; //agrega cero si el menor de 10
      if (mes < 10)
        mes = '0' + mes //agrega cero si el menor de 10


      document.getElementById('fechasiniestro').value = [ano, mes, dia].join('-');
   

    } 

   

  </script>

  <div class="cont-1300">
<div class="alta-form">
 <form action="/updatesiniestro/<%= data.polizasiniestrada[0].Id_Poliza %>" method="post">
  
            

        
        <% if (data) { %>


          <div class="form-cont">
            <div class="box">            
               
              <div class="form-group" style="font-size: 13px;">
                <label style="font-size: 13px;">Fecha Siniestro</label>
                <% mifecha=data.polizasiniestrada[0].Fecha_Siniestro %>                                   
                <% dia = mifecha.getUTCDate().toString().padStart(2, '0') %>
                <% mes = (mifecha.getUTCMonth() + 1).toString().padStart(2, '0') %>
                <% anio = mifecha.getUTCFullYear() %>
                <% fechaCorrectaSiniestro = `${anio}-${mes}-${dia}`; %> 
                  <input value="<%= fechaCorrectaSiniestro %>" id="fechatextdesde" type="hidden">
                  <input style="font-size: 13px;" class="form-control" value="" type="date" id="fechasiniestro"
                    name="fechasiniestro" required>

              </div>                 
             



              <div class="form-group" style="font-size: 13px;">
                <label style="font-size: 13px;">Comentario</label>
               <textarea rows="4"  cols="50"  style="font-size: 13px; width: 300px; height: 100px;" class="form-control" id="comentario" name="comentario"><%= data.polizasiniestrada[0].Comentario %> </textarea>
              </div>

            

            </div>




          </div>
         






            <br>       
     
            <div style="width: 100%; display: flex; justify-content: space-between;">
              <div style="text-align: felt; padding-left: 3px; ">
                <% if ((process.env.rol==1) || (process.env.rol==2)) { %>
                  
                  <button type="submit" class="btn btn-secondary"
                    style="height: 39px; width:250px; background-color: darkslateblue; margin-left: 10px; font-size: 15px;">
                    Efectura los Cambios
                  </button>
                  
                  <% } %>
              </div>

              <div style="text-align: right; text-decoration: none; padding-right: 3px;">
                <a href="javascript:window.history.back();"
                  style="height: 39px; width:250px;; background-color: darkslateblue; margin-right: 10px; font-size: 15px;"
                  class="btn btn-secondary"> Volver</a>
              </div>

            </div>
        <% } %>


      </form>
    </div>
  </div>

  <script src="//cdn.jsdelivr.net/npm/sweetalert2@10"></script>

  <% if(typeof alert !="undefined" ) { %>
    <script>
      Swal.fire({
        text: '<%= alertMessage %>',
      }).then(() => {
       window.location = '<%= ruta %>'
      })            
    </script>
    <% } %>



      <%- include('partials/_footer'); %>