Commit 7a3dda8b authored by Yonathan suarez's avatar Yonathan suarez
Browse files

BASE PROYECTO

parents
<div class="portlet light bordered">
<div class="portlet-body">
<div class="tabbable tabbable-tabdrop">
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab1" data-toggle="tab">Crear Codigos</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<!-- contenido datos basicos -->
<div class="col-md-12">
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-striped table-hover">
<thead>
<tr>
<form role="form" action="?admin=listac&guarda" method="post" enctype="multipart/form-data">
<center>
<th><center>Codigo Nuevo</center></th>
<th><center>Limite</center></th>
</center>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php
function generarCodigo($longitud) {
$key = '';
$pattern = '1234567890abcdefghijklmnopqrstuvwxyz';
$max = strlen($pattern)-1;
for($i=0;$i < $longitud;$i++) $key .= $pattern{mt_rand(0,$max)};
return $key;
}
//Ejemplo de uso
// genera un código de 6 caracteres de longitud.
?>
<input type="text" required type="tex" name="codigo" value="<?php echo generarCodigo(6) ?>" required class="form-control">
</td>
<td>
<input type="number" maxlength="number" required type="text" min="1" name="limite" value="1" required class="form-control">
</td>
</tr>
</div>
</tbody>
<th><center>Seleccionar Paquete</center></th>
<th><center></center></th>
</tr>
</thead>
</tbody>
<th><center></center></th>
<th><center></center></th>
</tr>
</thead>
<tbody>
<tr>
<?php
$consulta="SELECT * FROM paquete ";
$bd->consulta($consulta);
?>
<td>
<select class="form-control" name="paquete">
<?php while ($pagina=$bd->mostrar_registros()) {
?>
<option value="<?php echo $id=$pagina->id_paquete; ?>"><p><?php echo $nomp=$pagina->nombre_p; ?></p> </option>
<?php
}
?>
</select>
</td>
<td>
<div class="col-md-10"></div>
<center>
<button type="submit" class="btn btn-primary btn-lg" name="lugarguardar" value="Guardar">Guardar </button>
</center>
</td>
</tr>
</div>
</tbody>
</table>
</form>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
</div>
</div>
</div>
</div>
</IMG>
</center>
</div>
</div>
\ No newline at end of file
<?php
include '../inc/config.php';
$x1=$_GET["codigo"];
if (isset($_POST) && count($_POST)>0)
{
if ($db->connect_errno)
{
die ("<span class='ko'>Fallo al conectar a MySQL: (" . $db->connect_errno . ") " . $db->connect_error."</span>");
}
else
{
$query=$db->query("update paquete set ".$_POST["campo"]."='".$_POST["valor"]."' where id_paquete='".intval($_POST["id"])."' limit 1");
if ($query) echo "<span class='ok'>Valores modificados correctamente.</span>";
else echo "<span class='ko'>".$db->error."</span>";
}
}
if (isset($_GET) && count($_GET)>0)
{
if ($db->connect_errno)
{
die ("<span class='ko'>Fallo al conectar a MySQL: (" . $db->connect_errno . ") " . $db->connect_error."</span>");
}
else
{
// select * from editinplace order by idusuario asc
$query=$db->query("SELECT * FROM paquete ");
$datos=array();
while ($usuarios=$query->fetch_array())
{
$datos[]=array( "id"=>$usuarios["id_paquete"],
"nombre_p"=>$usuarios["nombre_p"],
"precio"=>$usuarios["precio"]
);
}
echo json_encode($datos);
}
}
?>
\ No newline at end of file
<?php
include '../inc/config.php';
$idu=$_GET['idu'];
if (isset($_POST) && count($_POST)>0)
{
if ($db->connect_errno)
{
die ("<span class='ko'>Fallo al conectar a MySQL: (" . $db->connect_errno . ") " . $db->connect_error."</span>");
}
else
{
$query=$db->query("update service set ".$_POST["campo"]."='".$_POST["valor"]."' where id_service='".intval($_POST["id"])."' limit 1");
if ($query) echo "<span class='ok'>Valores modificados correctamente.</span>";
else echo "<span class='ko'>".$db->error."</span>";
}
}
if (isset($_GET) && count($_GET)>0)
{
if ($db->connect_errno)
{
die ("<span class='ko'>Fallo al conectar a MySQL: (" . $db->connect_errno . ") " . $db->connect_error."</span>");
}
else
{
// select * from editinplace order by idusuario asc
$query=$db->query("SELECT * FROM service where id_service=$idu");
$datos=array();
while ($usuarios=$query->fetch_array())
{
$datos[]=array( "id"=>$usuarios["id_service"],
"nombre"=>$usuarios["name_service"],
"precio"=>$usuarios["price_service"],
"cantida"=>$usuarios["cantida"],
"tipo"=>$usuarios["tipo_producto"],
"info"=>$usuarios["info_service"],
"imagen"=>$usuarios["imagen"]
);
}
echo json_encode($datos);
}
}
?>
\ No newline at end of file
This diff is collapsed.
<?php
include '../inc/config.php';
include '../inc/comun.php';
$bd = new GestarBD;
echo $x1=$_GET['codigo'];
if($_FILES["imagenprin"]!=""){
$ver="SELECT name_service,imagen FROM service WHERE id_service=$x1";
$bd->consulta($ver);
while ($fila=$bd->mostrar_registros()) {
$a=$fila->name_service;
$b=$fila->imagen;
}
if($a==""){
echo "se ha producido un error, primero registra el titulo del proyecto en la pestaña datos basicos";
}
if($b==""){
$reporte = null;
for($x=0; $x<count($_FILES["imagenprin"]["name"]); $x++)
{
$file = $_FILES["imagenprin"];
$nombre = $file["name"][$x];
$tipo = $file["type"][$x];
$ruta_provisional = $file["tmp_name"][$x];
$size = $file["size"][$x];
$width = $dimensiones[0];
$height = $dimensiones[1];
$carpeta = "../../producto/";
if ($tipo != 'image/jpeg' && $tipo != 'image/jpg' && $tipo != 'image/png' && $tipo != 'image/gif')
{
echo "<p style='color: red'>Error $nombre, el archivo no es una imagen </p>";
}
else if($size > 1024*1024)// 1024*1024 = 1 MB
{
echo "<p style='color: red'>Error $nombre, el tamaño máximo permitido es 1MB</p>";
}else{
$gale="producto_";
$name2=$gale.$a.$nombre;
$name3 = preg_replace('[\s+]','', $name2);
$src = $carpeta.$name3;
echo move_uploaded_file($ruta_provisional, $src);
$sql="UPDATE `service` SET `imagen` = '$name3' WHERE `service`.`id_service` = $x1";
$bd->consulta($sql);
}
}//fin for
}else{//fin de b=""
$reporte = null;
for($x=0; $x<count($_FILES["imagenprin"]["name"]); $x++)
{
$file = $_FILES["imagenprin"];
$nombre = $file["name"][$x];
$tipo = $file["type"][$x];
$ruta_provisional = $file["tmp_name"][$x];
$size = $file["size"][$x];
$width = $dimensiones[0];
$height = $dimensiones[1];
$carpeta = "../producto/";
if ($tipo != 'image/jpeg' && $tipo != 'image/jpg' && $tipo != 'image/png' && $tipo != 'image/gif')
{
echo "<p style='color: red'>Error $nombre, el archivo no es una imagen </p>";
}
else if($size > 1024*1024)// 1024*1024 = 1 MB
{
echo "<p style='color: red'>Error $nombre, el tamaño máximo permitido es 1MB</p>";
}else
{
$gale="producto_";
$name2=$gale.$a.$nombre;
$name3 = preg_replace('[\s+]','', $name2);
$src = $carpeta.$name3;
echo move_uploaded_file($ruta_provisional, $src);
$sql="UPDATE `service` SET `imagen` = '$name3' WHERE `service`.`id_service` = $x1";
$bd->consulta($sql);
}
}//fin for
}//fin else
}//fin edita fondo;
?>
\ No newline at end of file
This diff is collapsed.
var EcommerceDashboard = function() {
function showTooltip(x, y, labelX, labelY) {
$('<div id="tooltip" class="chart-tooltip">' + (labelY.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,')) + 'USD<\/div>').css({
position: 'absolute',
display: 'none',
top: y - 40,
left: x - 60,
border: '0px solid #ccc',
padding: '2px 6px',
'background-color': '#fff'
}).appendTo("body").fadeIn(200);
}
window.onload = function () {
}
var initChart1 = function() {
var dataLength = 0;
var data = [];
$.getJSON("http://localhost/pagos/panel/api/entradagrafica.php", function (result) {
dataLength = result.length;
for (var i = 0; i < dataLength; i++) {
data.push({
"0": parseInt(result[i].valorx),
"1": parseInt(result[i].valory),
});
}
;
});
var data = [
['01/01/2017', 4],
['01/02/2017', 4],
['03/03/2017', 4],
['06/04/2017', 4],
['09/05/2017', 4]
];
console.log(data);
var plot_statistics = $.plot(
$("#statistics_1"), [{
data: data,
lines: {
fill: 0.6,
lineWidth: 0
},
color: ['#f89f9f']
}, {
data: data,
points: {
show: true,
fill: true,
radius: 5,
fillColor: "#f89f9f",
lineWidth: 3
},
color: '#fff',
shadowSize: 0
}], {
xaxis: {
tickLength: 0,
tickDecimals: 0,
mode: "categories",
min: 2,
font: {
lineHeight: 15,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
yaxis: {
ticks: 3,
tickDecimals: 0,
tickColor: "#f0f0f0",
font: {
lineHeight: 15,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
grid: {
backgroundColor: {
colors: ["#fff", "#fff"]
},
borderWidth: 1,
borderColor: "#f0f0f0",
margin: 0,
minBorderMargin: 0,
labelMargin: 20,
hoverable: true,
clickable: true,
mouseActiveRadius: 6
},
legend: {
show: false
}
}
);
var previousPoint = null;
$("#statistics_1").bind("plothover", function(event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1]);
}
} else {
$("#tooltip").remove();
previousPoint = null;
}
});
}
var initChart2 = function() {
var data = [
['01/2013', 10],
['02/2013', 0],
['03/2013', 10],
['04/2013', 12],
['05/2013', 212],
['06/2013', 324],
['07/2013', 122],
['08/2013', 136],
['09/2013', 250],
['10/2013', 99],
['11/2013', 190]
];
var plot_statistics = $.plot(
$("#statistics_2"), [{
data: data,
lines: {
fill: 0.6,
lineWidth: 0
},
color: ['#BAD9F5']
}, {
data: data,
points: {
show: true,
fill: true,
radius: 5,
fillColor: "#BAD9F5",
lineWidth: 3
},
color: '#fff',
shadowSize: 0
}], {
xaxis: {
tickLength: 0,
tickDecimals: 0,
mode: "categories",
min: 2,
font: {
lineHeight: 14,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
yaxis: {
ticks: 3,
tickDecimals: 0,
tickColor: "#f0f0f0",
font: {
lineHeight: 14,
style: "normal",
variant: "small-caps",
color: "#6F7B8A"
}
},
grid: {
backgroundColor: {
colors: ["#fff", "#fff"]
},
borderWidth: 1,
borderColor: "#f0f0f0",
margin: 0,
minBorderMargin: 0,
labelMargin: 20,
hoverable: true,
clickable: true,
mouseActiveRadius: 6
},
legend: {
show: false
}
}
);
var previousPoint = null;
$("#statistics_2").bind("plothover", function(event, pos, item) {
$("#x").text(pos.x.toFixed(2));
$("#y").text(pos.y.toFixed(2));
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.datapoint[0], item.datapoint[1]);
}
} else {
$("#tooltip").remove();
previousPoint = null;
}
});
}
return {
//main function
init: function() {
initChart1();
$('#statistics_orders_tab').on('shown.bs.tab', function(e) {
initChart2();
});
}
};
}();
jQuery(document).ready(function() {
EcommerceDashboard.init();
});
\ No newline at end of file
<script type="text/javascript">