2018-07-18 04:28:26 -05:00
|
|
|
d3.select("li#evento").style("background-color","#cedeef");
|
|
|
|
|
var li = d3.select("article.label","ul").selectAll("li");
|
2020-01-22 18:22:31 -06:00
|
|
|
var img_path = "/proc/cal/img/";
|
2018-07-19 03:45:46 -05:00
|
|
|
var json_path = "/admin/json/";
|
2018-07-18 04:28:26 -05:00
|
|
|
/* 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;
|
2018-07-20 05:16:47 -05:00
|
|
|
d3.json( json_path+"event/"+eprev_id ,function(d){
|
|
|
|
|
if(d !=undefined) {if(d.cid != 0){
|
|
|
|
|
dropdownUpdate("ecourse",d.cid);
|
|
|
|
|
dropdownUpdate("eplace",d.pid);
|
|
|
|
|
d3.select("input#dini").attr("value",d.dini);
|
|
|
|
|
dropdownUpdate("mini",d.mini);
|
|
|
|
|
dropdownUpdate("yini",d.yini);
|
|
|
|
|
d3.select("input#dend").attr("value",d.dend);
|
|
|
|
|
dropdownUpdate("mend",d.mend);
|
|
|
|
|
dropdownUpdate("yend",d.yend);
|
|
|
|
|
d3.select("input#cost").attr("value",d.cost);
|
|
|
|
|
d3.select("input#promo").attr("value",d.promo);
|
|
|
|
|
d3.select("input#pen").attr("checked",d.pen);
|
|
|
|
|
d3.select("input#een").attr("checked",d.een);
|
|
|
|
|
dropdownUpdate("eimg",d.eimg);
|
2018-07-18 04:28:26 -05:00
|
|
|
updateImage();
|
|
|
|
|
}} }); });
|
|
|
|
|
|
|
|
|
|
/*preload form content for course*/
|
|
|
|
|
d3.select("select#cprev").on("change",function(){
|
|
|
|
|
var cprev_id=d3.select("select#cprev").node().value;
|
2018-07-20 05:16:47 -05:00
|
|
|
d3.json(json_path+"course/"+cprev_id ,function(d){
|
|
|
|
|
if(d!=undefined){if(d.cid != 0){
|
|
|
|
|
d3.select("input#cname").attr("value",d.cname);
|
2020-01-22 18:22:31 -06:00
|
|
|
d3.select("input#csubname").attr("value",d.csubname);
|
|
|
|
|
d3.select("textarea#cdesc").text(d.cdesc);
|
|
|
|
|
d3.select("input#cmas").attr("value",d.mas);
|
2018-07-20 05:16:47 -05:00
|
|
|
d3.select("textarea#csubjects").text(d.csubjects);
|
|
|
|
|
d3.select("textarea#cservices").text(d.cservices);
|
2018-07-18 04:28:26 -05:00
|
|
|
}} }); });
|
|
|
|
|
|
2020-01-22 18:22:31 -06:00
|
|
|
function updateImagea(){
|
|
|
|
|
var iname=d3.select("select#cimga").node().value;
|
|
|
|
|
if(iname != 0){
|
|
|
|
|
d3.select("div#cimg").style("background-image","url("+img_path+iname+")");}
|
|
|
|
|
else{ d3.select("div#cimg").style("background-image","none"); }
|
|
|
|
|
}
|
|
|
|
|
d3.select("select#cimga").on("change",updateImagea);
|
|
|
|
|
|
2018-07-18 04:28:26 -05:00
|
|
|
/*preload form content for place*/
|
|
|
|
|
d3.select("select#pprev").on("change",function(){
|
|
|
|
|
var pprev_id=d3.select("select#pprev").node().value;
|
2018-07-20 05:16:47 -05:00
|
|
|
d3.json(json_path+"place/"+pprev_id ,function(d){
|
|
|
|
|
if(d!=undefined){if(d.pid != 0){
|
|
|
|
|
d3.select("input#pname").attr("value",d.pname);
|
|
|
|
|
d3.select("input#paddr").attr("value",d.paddr);
|
|
|
|
|
d3.select("input#pobs").attr("value",d.pobs);
|
|
|
|
|
d3.select("input#pto").attr("value",d.pto);
|
|
|
|
|
d3.select("input#pst").attr("value",d.pst);
|
|
|
|
|
d3.select("input#pco").attr("value",d.pco);
|
|
|
|
|
d3.select("input#plat").attr("value",d.plat);
|
|
|
|
|
d3.select("input#plng").attr("value",d.plng);
|
|
|
|
|
d3.select("input#pen").attr("checked",d.pen);
|
2018-07-18 04:28:26 -05:00
|
|
|
}} }); });
|
|
|
|
|
|
|
|
|
|
/*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; }); });
|
|
|
|
|
}
|