<?php
session_start();
require_once 'script_php/Softcom.php';
$fabricante = new Softcom();
?>

<!DOCTYPE html>
<html>
<head>

</script>

    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
    
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>

<?php include_once 'head.html' ?>

<title></title>
</head>

<body>

    <?php include_once 'header.php'; ?>

<section>

<h5>

<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-app-indicator" viewBox="0 0 16 16">
  <path d="M5.5 2A3.5 3.5 0 0 0 2 5.5v5A3.5 3.5 0 0 0 5.5 14h5a3.5 3.5 0 0 0 3.5-3.5V8a.5.5 0 0 1 1 0v2.5a4.5 4.5 0 0 1-4.5 4.5h-5A4.5 4.5 0 0 1 1 10.5v-5A4.5 4.5 0 0 1 5.5 1H8a.5.5 0 0 1 0 1z"/>
  <path d="M16 3a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
</svg>

Preenha o filtro abaixo</h5>

<p></p>

<form action="">

<label for="inicio"> Data inicio
<input type="date" id="inicio" name="dataInicio" class="form-control form_forn">
</label>
<p></p>
<label for="final"> Data Final
    <input type="date" name="dataFinal" id="final" class="form-control form_forn">
</label>
<p></p>

<p>* Fabricante <br>

	<?php
	//nova instancia da classe softcom
	$dadosSql = new Softcom();
?>
        <select id="fabricantes" class="form-control selecao form_forn " name="serie[]">
        <?php

            $dados = $fabricante->BuscarFabricante();

            foreach ($dados as $novo) {
                
                echo "<option value='{$novo[0]}'>{$novo[0]}</option>";
            
           }
            ?>
</select>

<P></P>

<input type="submit" class="btn btn-warning">

</form>

</section>



 <script>
        $(document).ready(function () {
            $('#fabricantes').select2({
                placeholder: "Selecione os fabricantes",
                allowClear: true
            });

            // Atualizar lista de fabricantes selecionados
            $('#fabricantes').on('change', function () {
                const selected = $(this).val();
                const list = $('#selected-fabricantes');
                list.empty();
                if (selected) {
                    selected.forEach(item => {
                        //list.append(`<li>${item}</li>`);
                    });
                }
            });
        });
    </script>

<?php include_once 'footer.php' ?>