This commit is contained in:
mynah
2018-07-18 04:28:26 -05:00
parent 0a7d71e21c
commit 4f0061cd7d
61 changed files with 1396 additions and 43 deletions

View File

View File

View File

@@ -0,0 +1,89 @@
p.title{
font-size:3em;
color:black;
font-weight:bold;
margin:10px;
text-align:center;
}
section.event{
justify-content:center;
-webkit-justify-content:center;
}
article.label{
flex:1;
min-width:100px;
max-width:130px;
background-color:#e6eeff; /*js*/
}
article.label > ul {
list-style-type: none;
padding: 0px;
margin: 10px;
text-align: center;
}
article.label > ul > li{
margin:5px 0px;
cursor:pointer;
}
article.label > ul > li:hover{
background-color:#cedeef;
}
article.edit{
flex:5;
max-width:530px;
min-width:200px;
}
article.edit label{
padding:5px 30px 5px 10px;
min-width:130px;
}
div#event{display:block;}
div#course{display:none;}
div#place{display:none;}
div.field{
justify-content:baseline;
-webkit-justify-content:baseline;
margin:5px;
}
article.edit select{
flex:3;
max-width:400px;
}
article.edit input[type=text] {
flex:3;
max-width:400px;
}
article.edit input[name=cost]{
width:100px;
}
article.edit input[type=number]{
width:60px;
}
article.edit textarea{
flex:3;
max-width:400px;
min-height:150px;
border: 3px solid #cccccc;
}
div.update{
background-color:#f2f5fc;
}
article.edit input[type=submit]{
margin:15px;
}
div#esimg{
height:180px;
width:180px;
background-color:gray;
background-position:center;
background-repeat:no-repeat;
background-size:contain;
}
select#eimg{
height:30px;
}

View File

@@ -0,0 +1,155 @@
<section class="name" flex> <article class="user">
<p class="title">Editar Eventos</p>
</article> </section>
<section class="event flex">
<article class="label">
<ul>
<li id="evento" value="event">Evento</li>
<li id="curso" value="course">Curso</li>
<li id="lugar" value="place">Lugar</li>
</ul>
</article>
<article class="edit">
<!-- Evento ======================================================= -->
<div class="ehide" id="event"> <form action=" #nav admine" method="POST">
<div class="flex field">
<label>Curso</label>
<select id="ecourse" name="ecourse"> <!-- a#dropvar -->
<!-- ##ecourse --> <!-- r##hide -->
<!-- c#ecourse
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
</div>
<div class="flex field">
<label>Lugar</label> <!-- dropdown -->
<select id="eplace" name="eplace"> <!-- a#dropvar -->
<!-- ##eplace --> <!-- r##hide -->
<!-- c#eplace
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
</div>
<div class="flex field">
<label>Fecha inicio</label> <!-- dropdown -->
<input id="dini" type="number" min="1" max="31" name="dini" value="1"/> <!-- a#dropvar -->
<select id="mini" name="mini"> <!-- a#dropvar -->
<!-- ##emini --> <!-- r##hide -->
<!-- c#emini
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
<input id="yini" type="number" min="2017" max="2050" name="yini" value="2017"/> <!-- a#dropvar -->
</div>
<div class="flex field">
<label>Fecha fin</label> <!-- dropdown -->
<input id="dend" type="number" min="1" max="31" name="dend" value="1"/> <!-- a#dropvar -->
<select id="mend" name="mend"> <!-- a#dropvar -->
<!-- ##emini -->
</select>
<input id="yend" type="number" min="2017" max="2050" name="yend" value="2017"/> <!-- a#dropvar -->
</div>
<div class="flex field">
<label>Costo</label> <input id="cost" type="text" name="cost"/> <!-- a#dropvar -->
</div>
<div class="flex field">
<label>Promoción</label><input id="promo" type="text" name="promo"/> <!-- a#dropvar -->
<label>Habilitar</label><input type="checkbox" checked="checked" id="pen" name="pen"/> <!-- a#dropvar -->
</div>
<div class="flex field">
<label>Imagen</label> <!-- dropdown -->
<select id="eimg" name="eimg"> <!-- a#dropvar -->
<option value="0" selected> -- Elegir imagen -- </option>
<!-- ##ilist --> <!-- r##hide -->
<!-- c#ilist
<option value=" #name "> #name </option>
--> <!-- rr#hide -->
</select>
<div id=esimg></div>
</div>
<div class="flex field">
<label>Existente</label>
<select id="eprev" name="eprev"> <!-- a#dropvar -->
<option value="0">-- Nuevo --</option>
<!-- ##eprev --> <!-- r##hide -->
<!-- c#eprev
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
</div>
<div class="flex field update">
<input type="hidden" name="update" value="1"> <!-- a#dropvar -->
<input type="submit" name="eup" value="Aceptar"> <!-- a#dropvar -->
<input type="submit" name="edel" value="Eliminar"> <!-- a#dropvar -->
<label>Habilitar</label>
<input id="een" type="checkbox" checked="checked" name="een" > <!-- a#dropvar -->
</div>
</form> </div>
<!-- Curso ====================================================== -->
<div class="ehide" id="course"><form id="fcourse" action=" #nav admine"
method="POST">
<div class="flex field">
<label>Nombre</label>
<input id="cname" type="text" name="cname"/> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Temario</label>
<textarea form="fcourse" id="csubjects" name="csubjects"></textarea> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Servicios</label>
<textarea form="fcourse" id="cservices" name="cservices"></textarea> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Existente</label>
<select id="cprev" name="cprev"> <!-- a#dropvar -->
<option value="0">-- Nuevo --</option>
<!-- ##cprev --> <!-- r##hide -->
<!-- c#cprev
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
</div> <div class="flex field update">
<input type="hidden" name="update" value="1"> <!-- a#dropvar -->
<input type="submit" name="cup" value="Aceptar"> <!-- a#dropvar -->
<input type="submit" name="cdel" value="Eliminar"> <!-- a#dropvar -->
<label>Habilitar</label>
<input type="checkbox" checked="checked" id="cen" name="cen" > <!-- a#dropvar -->
</div>
</form> </div>
<!-- Lugar -->
<div class="ehide" id="place"><form action=" #nav admine" method="POST">
<div class="flex field">
<label>Nombre</label><input type="text" id= "pname" name="pname"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Direccion</label> <input type="text" id="paddr" name="paddr"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Observación</label> <input type="text" id="pobs" name="pobs"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Municipio</label> <input type="text" id="pto" name="pto"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Entidad</label> <input type="text" id="pst" name="pst"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>País</label> <input type="text" id="pco" name="pco"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Latitud</label> <input type="text"id="plat" name="plat"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Longitud</label> <input type="text" id="plng" name="plng"> <!-- a#dropvar -->
</div> <div class="flex field">
<label>Existente</label>
<select id="pprev" name="pprev"> <!-- a#dropvar -->
<option value="0">-- Nuevo --</option>
<!-- ##pprev --> <!-- r##hide -->
<!-- c#pprev
<option value=" #id "> #name </option>
--> <!-- rr#hide -->
</select>
</div> <div class="flex field update">
<input type="hidden" name="update" value="1"> <!-- a#dropvar -->
<input type="submit" name="pup" value="Aceptar"> <!-- a#dropvar -->
<input type="submit" name="pdel" value="Eliminar"> <!-- a#dropvar -->
<label>Habilitar</label>
<input id="pen" type="checkbox" checked="checked" name="pen" > <!-- a#dropvar -->
</div>
</form> <div class="mapa"></div>
</article>
</section>

View File

@@ -0,0 +1,74 @@
d3.select("li#evento").style("background-color","#cedeef");
var li = d3.select("article.label","ul").selectAll("li");
var img_path = " #path ../../cal/img/";
var json_path = " #data admin/event/json/";
/* menu hide and show edit window*/
li.on("click",function(){
li.style("background-color","#e6eeff");
d3.select(this).style("background-color","#cedeef");
d3.selectAll("div.ehide").style("display","none");
d3.select( "div#"+d3.select(this).attr("value") ).style("display","block");
});
/*preview event image*/
function updateImage(){
var iname=d3.select("select#eimg").node().value;
if(iname != 0){
d3.select("div#esimg").style("background-image","url("+img_path+iname+")");}
else{ d3.select("div#esimg").style("background-image","none"); }
}
d3.select("select#eimg").on("change",updateImage);
/*preload form contents for event*/
d3.select("select#eprev").on("change",function(){
var eprev_id=d3.select("select#eprev").node().value;
d3.json( json_path+"qEvent.q&ecourse="+eprev_id ,function(d){
if(d[0] !=undefined) {if(d[0].cid != 0){
dropdownUpdate("ecourse",d[0].cid);
dropdownUpdate("eplace",d[0].pid);
d3.select("input#dini").attr("value",d[0].dini);
dropdownUpdate("mini",d[0].mini);
dropdownUpdate("yini",d[0].yini);
d3.select("input#dend").attr("value",d[0].dend);
dropdownUpdate("mend",d[0].mend);
dropdownUpdate("yend",d[0].yend);
d3.select("input#cost").attr("value",d[0].cost);
d3.select("input#promo").attr("value",d[0].promo);
d3.select("input#pen").attr("checked",d[0].pen);
d3.select("input#een").attr("checked",d[0].een);
dropdownUpdate("eimg",d[0].eimg);
updateImage();
}} }); });
/*preload form content for course*/
d3.select("select#cprev").on("change",function(){
var cprev_id=d3.select("select#cprev").node().value;
d3.json(json_path+"qCourse.q&course="+cprev_id ,function(d){
if(d[0]!=undefined){if(d[0].cid != 0){
d3.select("input#cname").attr("value",d[0].cname);
d3.select("textarea#csubjects").text(d[0].csubjects);
d3.select("textarea#cservices").text(d[0].cservices);
}} }); });
/*preload form content for place*/
d3.select("select#pprev").on("change",function(){
var pprev_id=d3.select("select#pprev").node().value;
d3.json(json_path+"qPlace.q&course="+pprev_id ,function(d){
if(d[0]!=undefined){if(d[0].pid != 0){
d3.select("input#pname").attr("value",d[0].pname);
d3.select("input#paddr").attr("value",d[0].paddr);
d3.select("input#pobs").attr("value",d[0].pobs);
d3.select("input#pto").attr("value",d[0].pto);
d3.select("input#pst").attr("value",d[0].pst);
d3.select("input#pco").attr("value",d[0].pco);
d3.select("input#plat").attr("value",d[0].plat);
d3.select("input#plng").attr("value",d[0].plng);
d3.select("input#pen").attr("checked",d[0].pen);
}} }); });
/*support "selected" option on other drop down*/
function dropdownUpdate(name,value){
d3.select("select#"+name).selectAll("option").each(function(d,i) {
d3.select(this).attr("selected",function(){
return this.value == value? "selected":null; }); });
}

View File

@@ -0,0 +1,17 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
id as "cid",
nombre as "cname",
temario as "csubjects",
servicios as "cservices"
from curso
where id= #course ;

View File

@@ -0,0 +1,29 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"event" as "tag",
id,
lugar_id as "pid",
curso_id as "cid",
precio as "cost",
promocion as "promo",
promo_estado as "pen",
day(fecha_inicio) as "dini",
month(fecha_inicio) as "mini",
year(fecha_inicio) as "yini",
day(fecha_fin) as "dend",
month(fecha_fin) as "mend",
year(fecha_fin) as "yend",
coalesce(imagen_chica,0) as "eimg",
estado as "een"
from evento
where id= #ecourse ;

View File

@@ -0,0 +1,22 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
id as "pid",
nombre as "pname",
direccion as "paddr",
observacion as "pobs",
municipio as "pto",
federativa as "pst",
pais as "pco",
lat as "plat",
lng as "plng",
estado as "pen"
from lugar
where id= #course ;

View File

@@ -0,0 +1,25 @@
#!/usr/bin/perl
use warnings;
use strict;
use JSON;
use Cwd 'abs_path';
use lib abs_path("../../")."/sibelius2/conf";
use Paths;
#-------------------------
print getNames( Paths::MOD ."/cal/img");
sub getNames{
my $dir = shift;
my @file_name;
opendir(DIR, $dir) or die "error opening dir: $dir \n$!";
while (my $file = readdir(DIR)) {
next unless ( $file =~m/^[\w\d]/);
next unless (-f "$dir/$file");
push(@file_name,{name=>$file,tag=>"ilist"});
}
closedir(DIR);
return encode_json( \@file_name );
}
1;
__END__

View File

@@ -0,0 +1,15 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"cprev" as "tag",
nombre as "name",
id
from curso
order by nombre asc;

View File

@@ -0,0 +1,12 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"ecourse" as "tag",
nombre as "name",
id
from curso where estado=1;

View File

@@ -0,0 +1,13 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"emend" as "tag",
nombre as "name",
id
from mes;

View File

@@ -0,0 +1,14 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"emini" as "tag",
nombre as "name",
id
from mes;

View File

@@ -0,0 +1,13 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"eplace" as "tag",
nombre as "name",
id
from lugar where estado=1;

View File

@@ -0,0 +1,18 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"eprev" as "tag",
concat(day(e.fecha_inicio)," de ",m.nombre," ",l.nombre) as "name",
e.id as id
from evento as e
inner join lugar as l on e.lugar_id=l.id
inner join mes as m on month(e.fecha_inicio)=m.id
where e.estado=1
order by e.fecha_inicio desc;

View File

@@ -0,0 +1,15 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_user */
/* c#password #dbdata_pass */
select
"pprev" as "tag",
nombre as "name",
id
from lugar
order by nombre asc;

View File

@@ -0,0 +1,20 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
insert into curso
(nombre,temario,servicios,estado)
values(
q#cname ,
q#csubjects ,
q#cservices ,
case q#cen when "on" then 1 else 0 end);

View File

@@ -0,0 +1,24 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
insert into evento
(lugar_id, fecha_inicio, fecha_fin,precio,curso_id,imagen_chica,estado,promocion,promo_estado)
values(
q#eplace ,
" #yini - #mini - #dini ",
" #yend - #mend - #dend ",
q#cost ,
q#ecourse ,
q#eimg ,
case q#een when "on" then 1 else 0 end,
q#promo ,
case q#pen when "on" then 1 else 0 end);

View File

@@ -0,0 +1,23 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
insert into lugar
(nombre,direccion,observacion,municipio,federativa,pais,lat,lng,estado)
values(
q#pname ,
q#paddr ,
q#pobs ,
q#pto ,
q#pst ,
q#pco ,
q#lat ,
q#lng ,
case q#pen when "on" then 1 else 0 end);

View File

@@ -0,0 +1,12 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
delete from curso
where id = q#cprev ;

View File

@@ -0,0 +1,18 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
update curso set
nombre = q#cname ,
temario= q#csubjects ,
servicios= q#cservices ,
estado = case q#cen when "on" then 1 else 0 end
where id = q#cprev ;

View File

@@ -0,0 +1,12 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
delete from evento
where id = q#eprev ;

View File

@@ -0,0 +1,22 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
update evento set
lugar_id = q#eplace ,
fecha_inicio=' #yini - #mini - #dini ',
fecha_fin= ' #yend - #mend - #dend ',
precio= q#cost ,
promocion= q#promo ,
promo_estado = case q#pen when "on" then 1 else 0 end,
curso_id= q#ecourse ,
imagen_chica= q#eimg ,
estado = case q#een when "on" then 1 else 0 end
where id = q#eprev ;

View File

@@ -0,0 +1,13 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
delete from lugar
where id = q#pprev ;

View File

@@ -0,0 +1,20 @@
/* c#host localhost*/
/* c#database #dbdata */
/* c#user #dbdata_w */
/* c#password #dbdata_wp */
/* c#write write*/
update lugar set
nombre= q#pname ,
direccion= q#paddr ,
observacion= q#pobs ,
municipio= q#pto ,
federativa= q#pst ,
pais= q#pco ,
lat= q#plat ,
lng= q#plng ,
estado = case q#pen when "on" then 1 else 0 end
where id = q#pprev ;