cleaning the house

This commit is contained in:
mynah
2020-01-20 14:49:59 -06:00
parent 252ec865b3
commit 7dfd107c04
81 changed files with 426 additions and 958 deletions

89
public/admin/event/event.css Executable 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:70px;
}
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;
}

74
public/admin/event/event.js Executable file
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 = "/home/cal/img/";
var json_path = "/admin/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+"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);
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+"course/"+cprev_id ,function(d){
if(d!=undefined){if(d.cid != 0){
d3.select("input#cname").attr("value",d.cname);
d3.select("textarea#csubjects").text(d.csubjects);
d3.select("textarea#cservices").text(d.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+"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);
}} }); });
/*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; }); });
}