modified: public/lib/inter.js

modified:   views/project.ejs
    changed:
        cost elements css;
        calculator width
This commit is contained in:
n0rdye 2023-11-17 13:56:28 +00:00
parent fdff3ff2f8
commit 0a9bbd60c2
2 changed files with 19 additions and 5 deletions

View File

@ -190,7 +190,7 @@ function calc_total(start = false){
let obj_cost_div = document.createElement("li"); let obj_cost_div = document.createElement("li");
obj_cost_div.innerHTML = obj_cost_div.innerHTML =
`<div style="display:flex;"> ` + `<div style="display:flex;"> ` +
`<div id='obj_cost_name' style='font-size:calc(var(--main-font-size)/1);'>${key.split("~g~")[0].replaceAll("$"," ")}`+ `<div id='obj_cost_name'>${key.split("~g~")[0].replaceAll("$"," ")}`+
`<div id='obj_cost_count'>&nbsp${Object.keys(value).length}X</div> </div>`+ `<div id='obj_cost_count'>&nbsp${Object.keys(value).length}X</div> </div>`+
`</div>`+ `</div>`+
`<div id='obj_cost'>${parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length)}</div>`; `<div id='obj_cost'>${parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length)}</div>`;
@ -202,7 +202,7 @@ function calc_total(start = false){
// return total; // return total;
objs["total"] = total; objs["total"] = total;
document.getElementById("proj_cost_text").innerText = `стоимость: ${total} руб.`; document.getElementById("proj_cost_text").innerText = `Стоимость: ${total} руб.`;
} }
function load(objss){ function load(objss){
@ -242,8 +242,12 @@ function load(objss){
function reload(save = false){ function reload(save = false){
// objs = JSON.parse($.cookie("objs")); // objs = JSON.parse($.cookie("objs"));
// console.log(objs); // console.log(objs);
// objs = objs.sort();
document.getElementById("drags").innerHTML = ""; document.getElementById("drags").innerHTML = "";
let cro = cur_obj;
load(objs); load(objs);
cur_obj = cro;
obj_selection();
if(save){save(()=>{},false)} if(save){save(()=>{},false)}
} }

View File

@ -147,7 +147,7 @@
</div> </div>
<div id="cost_div" style="display: flex;width: 15vw;justify-content: space-between;"> <div id="cost_div" style="display: flex;width: 15vw;justify-content: space-between;">
<button id="proj_cost" class="menu_btn" style="width: 100%;z-index: 3;"> <button id="proj_cost" class="menu_btn" style="width: 100%;z-index: 3;">
<div id="proj_cost_text" style="pointer-events: none;">Расчет стоимости</div> <div id="proj_cost_text" style="pointer-events: none;font-size:calc(var(--main-font-size)/1.2);">Стоимость</div>
<img src="/img/drop.png" style="width: 1vw;height: 0.5vw;pointer-events: none;" alt="\/"> <img src="/img/drop.png" style="width: 1vw;height: 0.5vw;pointer-events: none;" alt="\/">
</button> </button>
<style> <style>
@ -165,6 +165,15 @@
width: 14vw; width: 14vw;
padding: 0.45vw; padding: 0.45vw;
} }
#cost_list #obj_cost_name{
font-size:calc(var(--main-font-size)/1.3);
}
#cost_list #obj_cost_count{
font-size:calc(var(--main-font-size)/1.3);
}
#cost_list #obj_cost{
font-size:calc(var(--main-font-size)/1.3);
}
</style> </style>
<ul id="cost_list" class="cmenu"> <ul id="cost_list" class="cmenu">
</ul> </ul>
@ -320,7 +329,7 @@
} }
function img_download(){ function img_download(){
msg("добавить на фото стоимость?",{type:"ask",res:(out)=>{ msg("добавить на фото Стоимость?",{type:"ask",res:(out)=>{
let wait_msg = msg("делаем фото",{type:"wait"}) let wait_msg = msg("делаем фото",{type:"wait"})
proj_img((src)=>{ proj_img((src)=>{
msg("изображение проекта готово",{time:3}) msg("изображение проекта готово",{time:3})
@ -342,7 +351,7 @@
if(cost == true){ if(cost == true){
width += document.getElementById("proj_cost").getBoundingClientRect().width; width += document.getElementById("proj_cost").getBoundingClientRect().width;
document.getElementById("drags").append(document.getElementById("cost_div")); document.getElementById("drags").append(document.getElementById("cost_div"));
document.getElementById("cost_div").style.marginLeft = `${parseInt(document.getElementById("wall").style.width) + 4}px`; document.getElementById("cost_div").style.marginLeft = `${parseInt(document.getElementById("wall").style.width) + 1}px`;
document.getElementById("cost_list").style.display = "block"; document.getElementById("cost_list").style.display = "block";
} }
html2canvas(document.getElementById("drags"),{ html2canvas(document.getElementById("drags"),{
@ -465,6 +474,7 @@
} }
} }
// console.log(objs[obj.classList[0]][obj.getAttribute("id")]); // console.log(objs[obj.classList[0]][obj.getAttribute("id")]);
reload();
} }
function obj_del(){ function obj_del(){