<?php
	
	$id_empresa = $_GET["e"];
	$id = $_GET["id"];
	$hoy = date("Y-m-d H:i:s");

	
?>



<nav aria-label="breadcrumb" style="margin-top:15px" >
	<ol class="breadcrumb" style="background-color: rgba(0,0,0,0); margin-bottom:0px">
		<li class="breadcrumb-item"><a href="?pg=home">Home</a></li>
		<li class="breadcrumb-item active" aria-current="page"><a href="?pg=botones">Botones</a></li>
        <li class="breadcrumb-item active" aria-current="page">Detalle</li>
	</ol>
</nav>

<?php echo $respuesta; ?>

<div class="container" style="margin-top:15px">
	<div class="card">

        <!-- DETALLE -->
        <div class="card-body">
      
                <div class="row">

					<div class="col-md-12 item_input">
                    	<h3>Detalle</b></h3>
                    </div>

                
                    <div class="col-md-12 item_input">
                        <label class="ti_label">Tipo</label>
                        <input type="number" class="form-control" name="tipo" id="tipo">
                    </div>

                    <div class="col-md-12" style="margin-top: 15px; text-align: left;">
                        <button type="button" class="btn btn-success btn-block" style="border-radius: 30px;" onClick="GuardarNotificacion()">Guardar</button>
                    </div>
                            
                </div>
    
        </div>
    </div>

</div>





<style>
.item_input{
	margin-bottom:15px;
}
</style>

<script src="https://www.gstatic.com/firebasejs/4.9.0/firebase.js"></script>
<script>
  // Your web app's Firebase configuration
    var firebaseConfig = {
       apiKey: "AIzaSyBc4fFwumMcp1J9J2pejhpPQOfmPlFUp6o",
        authDomain: "ournorth-450c4.firebaseapp.com",
        databaseURL: "https://ournorth-450c4-default-rtdb.firebaseio.com",
        projectId: "ournorth-450c4",
        storageBucket: "ournorth-450c4.appspot.com",
        messagingSenderId: "281119170967",
        appId: "1:281119170967:web:17211ef88cdbaa080a64d2"
    };
    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
    var database = firebase.database();
	 
    
    //2. ESCUCHAMOS SI UN USUARIO SE CONECTA 
    var tb_notificaciones = database.ref('notificaciones');
    tb_notificaciones.on('value', Notificaciones);
    
    function Notificaciones(data){
        console.log(data.val());
    }
    
    function GuardarNotificacion() {
        if($("#tipo").val() != "" ){
            database.ref( 'notificaciones' ).set({
                tipo: $("#tipo").val() ,
                mensaje: 'boton',
                fecha : '2021-01-00 00:00:00'
            });

        }
        else{
            alert("Recuerda que todos los datos son obligatorios.");
        }
    }
    
</script>
