<?php
if(!isset($_COOKIE["sesion"])){
  echo '<meta http-equiv="refresh" content="0;url=./" />';
  die();
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include("style.php"); ?>
<title>Cotizador - MYPSA CASEWORK</title>
<body class="hold-transition sidebar-mini layout-fixed">
  <div class="wrapper">
    <?php include("menu.php") ?>
    <div class="content-wrapper">
      <div class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-8">
              <h3>Cotizaciones-Pedidos</h3>
            </div>
          </div>
        </div>
      </div>
      <section class="content" style="text-align: center;">
        <div class="form-group row">
          <div class="offset-md-4 col-2">
            <label>Desde</label>
            <input type="text" id="txtFechaIni" class="form-control form-control-sm flat-input">
          </div>
          <div class="col-2">
            <label>Hasta</label>
            <input type="text" id="txtFechaFin" class="form-control form-control-sm flat-input">
          </div>
          <div class="col-4" style="margin-top:31px !important">
            <input id="inputBusqueda" placeholder="&#xF002; Filtrar cotizaciones" class="form-control form-control-sm flat-input ftfamily" autofocus>
          </div>
        </div>
        <div class="form-group row">
          <div class="col-12">
            <table id="tablaCotizaciones" class="table table-bordered table-sm" style="width:100%;font-size:14px;background: white;">
              <thead>
                <tr>
                  <th>Folio</th>
                  <th>F. Alta</th>
                  <th>F. Cot</th>
                  <th>Proyecto</th>
                  <th>Total</th>
                  <th></th>
                </tr>
              </thead>
              <tbody></tbody>
              <tfoot>
                <tr>
                  <th></th>
                  <th></th>
                  <th></th>
                  <th></th>
                  <th></th>
                  <th></th>
                </tr>
              </tfoot>
            </table>
          </div>
        </div>
      </section>
    </div>
  </div>

  <!--MODAL PARA VER COTIZACIÓN-->
  <div class="modal" id="modalCotizacion" role="dialog" aria-labelledby="myModalLabels">
    <div class="modal-dialog modal-xl" role="document">
      <div class="modal-content">
        <div class="modal-body" style="text-align:center; height: 525px; overflow: auto;">
          <div class="form-group row">
            <div class="col-6">
              <br>
              <div class="input-group">
                <label>PROYECTO:</label>&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="text" class="form-control flat-input form-control-sm" id="inputDescCotizacion" readonly="true">
              </div>
            </div>
            <div class="offset-3 col-3">
              <div class='row'>
                <div class='col-6'>
                  <label style='text-align: right;'>Folio:</label>
                </div>
                <div class='col-6'>
                  <label style="font-weight: normal;" id="labelFolio">Nuevo</label>
                </div>
              </div>
              <div class='row'>
                <div class='col-6'>
                  <label style='text-align: right;'>Fecha:</label>
                </div>
                <div class='col-6'>
                  <label style="font-weight: normal;" id="labelFecha"></label>
                </div>
              </div>
              <div class='row'>
                <div class='col-6'>
                  <label style='text-align: right;'>Exportar:</label>
                </div>
                <div class='col-6'>
                  <div class='btn-group'>
                    <button class='btn btn-default btn-flat btn-sm' onclick="exportExcel()">Excel</button>
                    <button class='btn btn-default btn-flat btn-sm' id="btnVerPDF">PDF</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="form-group row">
            <div class="offset-7 col-5">
              <input type="text" id="inputBusquedaDetalle" placeholder="&#xF002; Filtrar cotización" class="form-control form-control-sm flat-input ftfamily">
            </div>
          </div>
          <div class="form-group row">
            <div class="col-12">
              <table id="tablaDetalle" class="table table-bordered table-sm" style="width:100%; font-size: 13px;">
                <thead>
                  <tr>
                    <th>#</th>
                    <th>Area</th>
                    <th>Mueble</th>
                    <th>Referencia</th>
                    <th>Cantidad</th>
                    <th>Unidad</th>
                    <th>Costo Uni</th>
                    <th>Importe</th>
                  </tr>
                </thead>
                <tbody id="bodyDetalle"></tbody>
                <tfoot>
                  <tr>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                  </tr>
                </tfoot>
              </table>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <div class="pull-left">
            <label style="font-weight:normal;font-size:14px;">*Precios sujetos a cambios sin previo aviso</label>
          </div>
          <button type="button" class="btn btn-danger btn-flat btn-sm" data-dismiss="modal">Cerrar</button>
        </div>
      </div>
    </div>
  </div>

  <!--MODAL DUPLICAR COTIZACIÓN-->
  <div class="modal" id="modalDuplicaCotizacion" role="dialog" aria-labelledby="myModalLabels">
    <div class="modal-dialog modal-dialog-centered" role="document">
      <div class="modal-content">
        <div class="modal-body">
          <div class="row">
            <div class="col-12" style="text-align: center;">
              <label>Indique el nombre de la nueva cotización duplicada</label>
              <input type="text" class="form-control flat-input" id="inputCotDuplicada">
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" data-toggle="tooltip" class="btn btn-default btn-flat btn-sm" data-dismiss="modal">Cancelar</button>
          <button type="button" id="btnGuardarCotDuplicada" class="btn btn-success btn-flat btn-sm">Guardar</button>
        </div>
      </div>
    </div>
  </div>

  <!--MODAL VER OBJETO-->
  <div class="modal" id="modalVerObjeto" role="dialog" aria-labelledby="myModalLabels">
    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
      <div class="modal-content" style="text-align:center">
        <div class="modal-body">
         <h3 style="text-align:center" id="lblCotizacion"></h3><br>
         <div class="row">
          <div class="col-6">
            <h5 style="font-weight: bold;">Información del mueble</h5>
            <div class="form-group row">
              <div class="col-6">
                <label>Categoría</label><br>
                <label style="font-weight: normal;" id="lblCategoria"></label>
              </div>
              <div class="col-6">
                <label>Mueble</label><br>
                <label style="font-weight:normal" id="lblMueble"></label>
              </div>
            </div>
            <div class="form-group row">
              <div class="col-6">
                <label>Cantidad</label><br>
                <label style="font-weight: normal;" id="lblCantidad"></label>
              </div>
              <div class="col-6">
                <label>Referencia</label><br>
                <label style="font-weight: normal;" id="lblReferencia"></label>
              </div>
            </div>
          </div>
          <div class="col-6">
            <div class="form-group row">
              <div class="col-12">
                <table id="tablaParametrosDetalle" class="table table-bordered table-sm" style="width:100%; font-size: 13px">
                  <thead>
                    <tr>
                      <th>Parámetro</th>
                      <th>Valor</th>
                    </tr>
                  </thead>
                  <tbody id="bodyParametrosDetalle"></tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-flat btn-sm" id="btnCerrarVerObjeto">Cerrar</button>
      </div>
    </div>
  </div>
</div>
<?php include("scripts.php"); ?>
<script type="text/javascript" src="scripts/pedidos.js"></script>
</body>
</html>
