first commit

This commit is contained in:
n0rdye
2023-02-22 00:49:40 +05:00
commit af41db4b4d
18 changed files with 1957 additions and 0 deletions

14
views/edit.ejs Normal file
View File

@ -0,0 +1,14 @@
<style>
*{
text-align: center;
}
</style>
<form action="/scripts" method="post">
<input type="hidden" name="name" value="<%= name %>">
<input type="text" name="pill" value="<%= pill %>">
<input type="text" name="date" value="<%= date %>">
<input type="text" name="comment" value="<%= comment %>">
<input type="hidden" name="func" value="edit">
<input type="submit" name="mode" value="save">
<input type="submit" name="mode" value="cancel">
</form>

44
views/inputs.ejs Normal file
View File

@ -0,0 +1,44 @@
<style>
.pill{
border: 1px black solid;
display: flex;
padding-inline: 3px;
}
.pill input{
margin: 0px;
/* padding: 20px; */
}
.pill label{
padding-inline: 4px;
padding-block: 1px;
}
.pills{
list-style-type: none;
display: flex;
}
.f1{
display: flex;
justify-content: space-evenly;
margin-block: 15px;
}
input{
text-align: center;
}
</style>
<form class="f1" action="/scripts" method="post">
<input type="submit" value="add">
<ul class="pills">
<%
let pills = ["4/2","4/1","4","2","2/1","1","0"];
let i=0;
pills.forEach(el => {
%>
<li class="pill"><label for="<%= i %>"><%= el %></label> <input id="<%= i %>" type="radio" name="pill" value="<%= el %>"></li>
<%
i++;
});
%>
</ul>
<input type="text" name="comment" value="-" placeholder="comment">
<input type="hidden" name="func" value="save">
</form>

73
views/user.ejs Normal file
View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.pill-el{
display: flex;
justify-content: space-between;
}
.pill-date,.pill-pill{
display: flex;
width: 150px;
justify-content: space-between;
}
body{
margin-inline: 50px;
}
ul{
padding: 0px;
margin: 0px;
}
</style>
</head>
<body>
<%- include("inputs") -%>
<ul>
<% jdata = data %>
<% for (const key in jdata) {
if (jdata.hasOwnProperty.call(jdata, key)) {
const element = jdata[key];
if(element["pill"]!=""&&element["pill"]!=null&&element["pill"]!=" "&&element["pill"]!="undefined"){
// pills.push(element["pill"]);
// ids.push(key);
// console.log(key);
%>
<li class="pill-el" id="pill-<%= key %>">
<div class="pill-date" id="pill-<%= key %>-date">
<form action="/scripts" method="post">
<input type="submit" value="del">
<input type="hidden" name="func" value="del">
<input type="hidden" name="pill" value="<%= key %>">
</form>
<%= element["date"] %>
</div>
<div class="pill-comment" id="pill-<%= key %>-comment">
<%= element["comment"] %>
</div>
<div class="pill-pill" id="pill-<%= key %>-pill">
<%= element["pill"] %>
<form action="/edit" method="post">
<input type="submit" value="edit">
<input type="hidden" name="func" value="edit">
<input type="hidden" name="name" value="<%= key %>">
<input type="hidden" name="date" value="<%= element["date"] %>">
<input type="hidden" name="pill" value="<%= element["pill"] %>">
<input type="hidden" name="comment" value="<%= element["comment"] %>">
</form>
</div>
</li>
<%
}
}
} %>
</ul>
</body>
</html>