modified: public/lib/inter.js

modified:   views/admin/objects/object_groups.ejs
	modified:   views/header.ejs
	modified:   views/load.ejs
	modified:   views/project.ejs
	modified:   views/static/end.ejs
	modified:   views/static/start.ejs
This commit is contained in:
n0rdye 2023-08-12 22:45:31 +05:00
parent 5133931122
commit b511d033f5
7 changed files with 117 additions and 34 deletions

View File

@ -52,6 +52,7 @@ function create(clas,x,y,body,id,size){
obj.style.height = `${db_data["height"] * 2}px`;
}
}
calc_total();
})
root.append(obj);
set_pos(obj,x,y);
@ -90,21 +91,35 @@ function wall_size_change(type,value = null){
}
}
function calc_total(){
function calc_total(start = false){
document.getElementById("cost_list").innerHTML = ""
if (start) {
document.getElementById("proj_cost").setAttribute("value",`стоимость: ${objs["total"]} руб.`);
return;
}
let total=0;
Object.entries(objs).forEach(([key,value]) => {
// console.log(key);
if(key != "height"&&key!="width"&key!="total"){
// console.log(key,value);
// console.log(Object.keys(value).length);
// console.log(objs_store[key]);
if(objs_store[key] != null){
// console.log(key,value);
total += parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length);
let obj_cost_div = document.createElement("li");
obj_cost_div.innerHTML =
`<div style="display:flex;"> <div id='obj_cost_name'>${key.split("/g/")[0].replace("$"," ")}</div>`+
`<div id='obj_cost_count'>&nbsp${Object.keys(value).length}x</div> </div>`+
`<div id='obj_cost'>${parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length)}</div>`;
document.getElementById("cost_list").append(obj_cost_div);
}
}
// console.log(Object.keys(objs).at(-1));
});
// return total;
document.getElementById("proj_cost").innerText = total;
objs["total"] = total;
document.getElementById("proj_cost").setAttribute("value",`стоимость: ${total} руб.`);
}
function load(objss){
@ -135,7 +150,6 @@ function load(objss){
}
});
resize_drags();
calc_total()
}
function load_proj_cloud(){

View File

@ -1,15 +1,16 @@
<style>
#obj_group button,#obj_group select{
height: 25px;
height: 50px;
margin: auto 0px;
}
</style>
<div id="obj_group">
<div style="display: flex;justify-content: space-between;">
<h1>группы товаров</h1>
<select name="" id="group_select" onchange="edit_get_objs();"></select>
<div style="display: flex;justify-content: space-between;width: 220px;">
<div style="display: flex;justify-content: space-between;width: 350px;">
<button onclick="create_new_group()">создать группу</button>
<button onclick="delete_group()">удалить группу</button>
</div>

View File

@ -49,16 +49,19 @@
background: ghostwhite;
cursor: pointer;
border: 1px black dashed;
padding: 5px;
padding: 2px;
width: 220px;
}
.cmenu{
position: fixed;
position: absolute;
display: grid;
background: ghostwhite;
color: black;
cursor: pointer;
border: 1px black solid;
z-index: 100;
border-top: 0px;
z-index: 500;
/* width: 218px; */
}
#top_panel_right_main{
/* float: right; */
@ -129,9 +132,10 @@
<div id="user_menu" class="cmenu"></div>
<div id="top_div" style="background-color: rgba(red, green, blue, 0.5); width: 100%;height: 100%;position: absolute;inset: 0px;z-index: 300; display: none;" onclick="hide_menus()"></div>
<script>
// get_from_uuid((res)=>{
get_from_uuid((res)=>{
// let uname = document.getElementById("user_name");
// let menu = document.getElementById("user_menu");
// let header = document.getElementById("top_panel");
@ -141,15 +145,19 @@
// if(document.title != "main") menu.innerHTML += `<button onclick="goto('/');">проекты</button> <br>`;
// right.innerHTML += `<div id="user_name" class="menu_btn">${res["login"]}</div>`;
// if (res["admin"] == true){
// menu.innerHTML += `<button onclick='goto("/admin")'>админ. панель</button><br>`;
// }
let menu = document.getElementById("top_panel_center");
if (res["admin"] == true){
menu.innerHTML += `<button onclick='goto("/admin")'>админ. панель</button><br>`;
}
// menu.innerHTML += "<button onclick='logout();'>выйти</button><br>";
// });
});
onscroll = (e)=>{
hide_menus();
}
onresize = (e)=>{
hide_menus();
}
onclick = (e) => {
// e.preventDefault()
// console.log(e);
@ -214,7 +222,13 @@
// document.body.appendChild(menu)
}
else if(e.target.id == "proj_cost"){
document.getElementById("cost_list").style = `margin-top:3vw;left:${e.target.getBoundingClientRect().left}px`;
console.log("cost_list");
}
else if(e.target.id == "group_drop"){
document.getElementById("group").style = `margin-top:2vw;left:${e.target.getBoundingClientRect().left}px;width: 14vw;padding: 7.5px;`;
console.log("group");
// hide_menus();
// let menu = document.getElementById("object_edit_menu");
// let obj = e.target;
@ -226,8 +240,8 @@
// // document.body.appendChild(menu)
}
else{
hide_menus();
}
// else{
// hide_menus();
// }
}
</script>

View File

@ -53,6 +53,7 @@
logo.style.left = loaded_pos.x;
logo.style.top = loaded_pos.y;
logo.style.width = loaded_pos.w
load_div.style.height = `${document.getElementsByTagName("body")[0].scrollHeight}px`;
}
function loading(){
let logo = document.getElementById("load_logo");
@ -63,5 +64,6 @@
logo.style.left = loading_pos.x;
logo.style.top = loading_pos.y;
logo.style.width = loading_pos.w
load_div.style.height = `${document.getElementsByTagName("body")[0].scrollHeight}px`;
}
</script>

View File

@ -112,7 +112,6 @@
position: absolute;
padding: 0px;
margin: 0px;
width: 200px;
}
</style>
@ -142,6 +141,27 @@
<label for="wall_color" style="margin: auto;">цвет стены</label>
<input type="color" id="wall_color" style="width: 50px;" value="#000000" onchange="wall_color_change()">
</div>
<div style="display: flex;width: 15vw;justify-content: space-between; background-color: #aaa;">
<input type="button" id="proj_cost" class="menu_btn" value="Расчет стоимости" onclick="cost_drop();open_menu();" style="width: 100%;">
<style>
#cost_list li{
display: flex;
justify-content: space-between;
width: 14vw;
}
#cost_list{
list-style-type: none;
padding-left: 0px;
margin-top: 59px;
position: absolute;
width: 14vw;
padding: 0.45vw;
}
</style>
<ul id="cost_list" class="cmenu">
</ul>
<!-- <div style="display: flex;"><div id="proj_cost"></div>&nbsp;руб.</div> -->
</div>
<!-- <div style="display: flex;width: 150px;justify-content: space-between;">
<label style="margin: auto;">Расчёт стоимости</label>
</div> -->
@ -154,14 +174,9 @@
<div class="wall dropzone" id="wall"></div>
</div>
<div style="display:flex; justify-content: space-around;"><div style="display: flex;"><div id="proj_cost"></div>&nbsp;руб.</div></div>
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;">
<div id="obj_group" style="display: flex;justify-content: space-between; width: 30vw;">
<!-- <button name="" id="group_drop" >Помехи на стене</button> -->
<button name="" id="group_drop" onclick="group_drop()">Оборудование</button>
<ul id="group" class="cmenu"></ul>
</div>
<div style="display: flex;justify-content: space-between; width: 20vw;">
<div>copy</div>
<div>back</div>
@ -173,6 +188,14 @@
<div>load</div>
</div>
</div>
<div class="inputs" style="display: flex;justify-content: space-between;margin-top: 0px;">
<div id="obj_group" style="display: flex;justify-content:space-evenly; width: 100vw;">
<!-- <button name="" id="group_drop" >Помехи на стене</button> -->
<button name="" id="group_drop" class="menu_btn" onclick="group_drop();open_menu();" style="width: 15vw;padding: 2px;">Оборудование</button>
<button name="" id="group_drop" class="menu_btn" onclick="group_drop();open_menu();" style="width: 15vw;padding: 2px;">помехи</button>
<ul id="group" class="cmenu"></ul>
</div>
</div>
<div class="czones" style="height: 500px;"></div>
@ -182,9 +205,9 @@
function group_drop(){
let e = document.getElementById("group_drop")
// document.getElementById("group").style = `top:${e.getBoundingClientRect().top+40}px;left:${e.getBoundingClientRect().left - 5}px`;
setTimeout(()=>{
document.getElementById("group").style.display = "block";
// document.getElementById("group").style.left = document.getElementById("group_drop").getBoundingClientRect().left;
let childs = document.getElementById("group").getElementsByTagName("input");
let i = 0;
Object.entries(childs).forEach(([key,value]) => {
@ -202,6 +225,28 @@
},1)
}
function cost_drop(id){
// let e = document.getElementById("cost")
// setTimeout(()=>{
// document.getElementById("group").style.display = "block";
// // document.getElementById("group").style.left = document.getElementById("group_drop").getBoundingClientRect().left;
// let childs = document.getElementById("group").getElementsByTagName("input");
// let i = 0;
// Object.entries(childs).forEach(([key,value]) => {
// console.log(key,value);
// if(value.checked == true){
// get_objs(value)
// i++;
// }
// if (i==0){
// document.getElementsByClassName("czones")[0].innerHTML = "";
// drag_start()
// // e.removeChild(e.getElementsByClassName(value))
// }
// });
// },1)
}
function wall_color_change(){
let wall = document.getElementById("wall")
let color = document.getElementById("wall_color")

View File

@ -14,6 +14,13 @@
Object.entries(menus).forEach(([key,menu]) => {
menu.style.display = "none";
});
let menu_screen = document.getElementById("top_div");
menu_screen.style.display = "none";
}
function open_menu(){
let menu_screen = document.getElementById("top_div");
menu_screen.style.display = "block";
menu_screen.style.height = `${document.getElementsByTagName("body")[0].scrollHeight}px`;
}
hide_menus();
$('form').on('submit', function(event) {

View File

@ -26,7 +26,7 @@
:root{
--login-inp-w:30vw;
--login-inp-h: 7.8vh;
--main-font-size: 1.5vw;
--main-font-size: 1.3vw;
}
.main{
width: 90vw;