Compare commits

...

10 Commits

Author SHA1 Message Date
5916d3a963 M Dockerfile
M db.js
 M docker-compose.yml
 M package-lock.json
 M package.json
2024-05-25 23:32:46 +05:00
51d6d44da2 add 2024-05-25 22:22:51 +05:00
557e60014d add 2024-05-25 22:14:27 +05:00
263a917bc9 Initial commit 2024-05-25 21:47:36 +05:00
d879798871 modified: views/project.ejs 2023-12-03 14:41:35 +00:00
98857bc518 modified: views/project.ejs 2023-11-29 15:42:03 +00:00
b568c7acc1 modified: public/lib/inter.js
modified:   views/admin/objects/group_object.ejs
	modified:   views/admin/objects/object_colors.ejs
	modified:   views/project.ejs
	modified:   views/template.ejs
    changes: color pallet size change
2023-11-24 10:11:42 +00:00
0a9bbd60c2 modified: public/lib/inter.js
modified:   views/project.ejs
    changed:
        cost elements css;
        calculator width
2023-11-17 13:56:28 +00:00
fdff3ff2f8 new file: update.sh
easy one command update function
2023-11-17 13:32:00 +00:00
3555ff1dec modified: views/admin/objects/object_edit.ejs
Changed:
        page behaviour when saved
        object loading from GET request
2023-11-17 13:29:02 +00:00
94 changed files with 50 additions and 27 deletions

View File

@ -1,2 +0,0 @@
node_modules
npm-debug.log

0
.gitattributes vendored Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

2
Dockerfile Normal file → Executable file
View File

@ -16,4 +16,4 @@ RUN npm install
COPY . .
EXPOSE 8080
CMD [ "node", "index.js" ]
CMD [ "node", "index.js" ]

0
admin.js Normal file → Executable file
View File

0
back_users.sql Normal file → Executable file
View File

2
db.js Normal file → Executable file
View File

@ -189,4 +189,4 @@ module.exports.crc = (table,callback,prevs = false) =>{
if(callback)callback(rows[0]["COUNT(*)"]);
}
})
}
}

1
docker-compose.yaml → docker-compose.yml Normal file → Executable file
View File

@ -1,5 +1,4 @@
version: '3.1'
services:
db:
image: mysql

0
func.js Normal file → Executable file
View File

0
index.js Normal file → Executable file
View File

0
object.js Normal file → Executable file
View File

4
package-lock.json generated Normal file → Executable file
View File

@ -1,11 +1,11 @@
{
"name": "puzle",
"name": "puzzle",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "puzle",
"name": "puzzle",
"version": "1.0.0",
"license": "ISC",
"dependencies": {

2
package.json Normal file → Executable file
View File

@ -14,7 +14,7 @@
"replace-color": "^2.3.0",
"uuid": "^9.0.0"
},
"name": "puzle",
"name": "puzzle",
"version": "1.0.0",
"main": "index.js",
"scripts": {

0
project.js Normal file → Executable file
View File

0
public/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
public/img/background/photo_2023-06-06_08-53-47 1.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

0
public/img/bg1red.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
public/img/drop.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

0
public/img/icon/back.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 600 B

0
public/img/icon/copy.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

0
public/img/icon/copy.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

0
public/img/icon/del.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 688 B

0
public/img/icon/down.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
public/img/icon/download.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 579 B

After

Width:  |  Height:  |  Size: 579 B

0
public/img/icon/download.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

0
public/img/icon/edit.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
public/img/icon/forw.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

0
public/img/icon/save.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
public/img/icon/save.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
public/img/icon/trash.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
public/img/icon/up.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

0
public/img/new_proj.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 848 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

0
public/img/ok.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
public/img/placeholder.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

0
public/img/proj_placeholder.webp Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 802 B

0
public/img/shadow-energy.gif Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 435 KiB

After

Width:  |  Height:  |  Size: 435 KiB

0
public/img/telegram.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
public/img/vk.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 721 B

0
public/img/youtube.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
public/lib/aes.js Normal file → Executable file
View File

0
public/lib/ejs.js Normal file → Executable file
View File

0
public/lib/fn.js Normal file → Executable file
View File

0
public/lib/html2canvas.js Normal file → Executable file
View File

12
public/lib/inter.js Normal file → Executable file
View File

@ -123,6 +123,10 @@ function obj_click(id){
function obj_selection(clear = false){
cur_obj = (clear == true)? null:cur_obj;
let drags = document.getElementsByClassName("drag");
// let layer_inp = document.getElementsByClassName("layer_inp");
// let obj_color = document.getElementsByClassName("obj_color_div");
// layer_inp.value = 0;
// obj_color.style.display = "none";
Object.values(drags).forEach(element => {
// console.log(element.id,cur_obj);
if (element.id != cur_obj){
@ -190,7 +194,7 @@ function calc_total(start = false){
let obj_cost_div = document.createElement("li");
obj_cost_div.innerHTML =
`<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>`+
`<div id='obj_cost'>${parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length)}</div>`;
@ -202,7 +206,7 @@ function calc_total(start = false){
// return total;
objs["total"] = total;
document.getElementById("proj_cost_text").innerText = `стоимость: ${total} руб.`;
document.getElementById("proj_cost_text").innerText = `Стоимость: ${total} руб.`;
}
function load(objss){
@ -242,8 +246,12 @@ function load(objss){
function reload(save = false){
// objs = JSON.parse($.cookie("objs"));
// console.log(objs);
// objs = objs.sort();
document.getElementById("drags").innerHTML = "";
let cro = cur_obj;
load(objs);
cur_obj = cro;
obj_selection();
if(save){save(()=>{},false)}
}

0
public/lib/inter_group_object.js Normal file → Executable file
View File

0
public/lib/inter_temp.js Normal file → Executable file
View File

0
public/lib/interact.js Normal file → Executable file
View File

0
public/lib/interact.js.map Normal file → Executable file
View File

0
public/lib/jquery.cookie.js Normal file → Executable file
View File

0
public/lib/jquery.js vendored Normal file → Executable file
View File

0
templates.js Normal file → Executable file
View File

3
update.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
git pull https://github.com/n0rdye/puzzle.git --autostash;
docker-compose restart;

0
user.js Normal file → Executable file
View File

0
vars.js Normal file → Executable file
View File

0
views/admin.ejs Normal file → Executable file
View File

0
views/admin/objects.ejs Normal file → Executable file
View File

4
views/admin/objects/group_object.ejs Normal file → Executable file
View File

@ -187,10 +187,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>

4
views/admin/objects/object_colors.ejs Normal file → Executable file
View File

@ -1,7 +1,7 @@
<div id="admin_colors" style="display: flex;justify-content: space-between;margin-top: 4vh;">
<div id="admin_colors" style="display: flex;justify-content: space-between;height: 6vh;">
<div id="obj_color_div" style="justify-content: space-between; width: 50vw;display: flex;">
<label for="obj_colors" style="min-width: 10vw;float: left;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
</div>
<div id="inp">
<input type="color" id="new_color" style="margin: auto;">

0
views/admin/objects/object_creation.ejs Normal file → Executable file
View File

10
views/admin/objects/object_edit.ejs Normal file → Executable file
View File

@ -61,6 +61,7 @@
// edit_get_objs();
// });
const get_object_id = new URL(window.location).searchParams.get("object_id");
let wait_msg_object_load = (get_object_id != null)? msg("загружаем прошлый объект",{type:"wait"}):null;
function set_edit(id){
@ -83,8 +84,7 @@
function edit_get_objs(by_name = false,callback){
document.getElementById("objs_in_group").innerHTML = "";
if (obj_edit_type == "edit") set_obj_edit_params();
let wait_msg_object_load = (get_object_id != null)? msg("загружаем прошлый объект",{type:"wait"}):null;
// if (obj_edit_type == "edit") set_obj_edit_params();
edit_load_objs((data)=>{
let wait_msg = msg("Загрузка объектов",{type:"wait"})
data.forEach(value => {
@ -98,6 +98,7 @@
if(get_object_id != null && wait_msg_object_load != null){
set_edit(get_object_id);
msg_del(wait_msg_object_load.id);
wait_msg_object_load = null;
}
if(callback)callback(true);
}
@ -194,9 +195,10 @@
msg("название товара не было изменино поскольку оно занято",{type:"warning"})
}
else{
window.history.pushState({}, null, `${(new URL(window.location)).toString().split("?")[0]}`);
// window.history.pushState({}, null, `${(new URL(window.location)).toString().split("?")[0]}`);
// delete get_object_id;
msg("товар сохранён");
set_obj_edit_params();
// set_obj_edit_params();
edit_get_objs();
}
}

0
views/admin/objects/object_groups.ejs Normal file → Executable file
View File

0
views/admin/users.ejs Normal file → Executable file
View File

0
views/admin/users/user_edit.ejs Normal file → Executable file
View File

0
views/admin/users/user_reg.ejs Normal file → Executable file
View File

0
views/header.ejs Normal file → Executable file
View File

0
views/help.ejs Normal file → Executable file
View File

0
views/load.ejs Normal file → Executable file
View File

0
views/login.ejs Normal file → Executable file
View File

0
views/main.ejs Normal file → Executable file
View File

0
views/message.ejs Normal file → Executable file
View File

0
views/old/project.ejs Normal file → Executable file
View File

27
views/project.ejs Normal file → Executable file
View File

@ -147,7 +147,7 @@
</div>
<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;">
<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="\/">
</button>
<style>
@ -165,6 +165,15 @@
width: 14vw;
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>
<ul id="cost_list" class="cmenu">
</ul>
@ -187,10 +196,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>
@ -320,7 +329,7 @@
}
function img_download(){
msg("добавить на фото стоимость?",{type:"ask",res:(out)=>{
msg("добавить на фото Стоимость?",{type:"ask",res:(out)=>{
let wait_msg = msg("делаем фото",{type:"wait"})
proj_img((src)=>{
msg("изображение проекта готово",{time:3})
@ -343,12 +352,13 @@
width += document.getElementById("proj_cost").getBoundingClientRect().width;
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.marginTop = `4px`;
document.getElementById("cost_list").style.display = "block";
}
html2canvas(document.getElementById("drags"),{
y:7,
x:2,
width:width,
y:6,
x:0,
width:(width+5),
logging:false
// scale:0.99
}).then(canvas => {
@ -418,6 +428,7 @@
}
function go_back(){
obj_selection(true)
if(objs_back.length > 0){
objs_forw.push(objs);
objs = objs_back.at(-1);
@ -427,6 +438,7 @@
}
}
function go_forw(){
obj_selection(true)
if(objs_forw.length > 0){
objs_back.push(objs);
objs = objs_forw.at(-1);
@ -465,6 +477,7 @@
}
}
// console.log(objs[obj.classList[0]][obj.getAttribute("id")]);
reload();
}
function obj_del(){

0
views/static/404.ejs Normal file → Executable file
View File

0
views/static/end.ejs Normal file → Executable file
View File

0
views/static/language.ejs Normal file → Executable file
View File

0
views/static/start.ejs Normal file → Executable file
View File

4
views/template.ejs Normal file → Executable file
View File

@ -187,10 +187,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 4.5vh;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>

0
views/templates.ejs Normal file → Executable file
View File