-
Notifications
You must be signed in to change notification settings - Fork 7
/
menu.html
226 lines (219 loc) · 9.7 KB
/
menu.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
{% load static %}
<!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>사자의 야심작</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="{% static 'js/menu.js' %}" defer></script>
<link rel="stylesheet" href="{% static 'css/menu.css' %}">
</head>
<body>
<header>
<h1 id="head-logo">
<a href="#"><img src="{% static 'image/LionAmbitious.png' %}"/></a>
</h1>
<div class="me-bar">
<p class="user-name">admin 님</p>
<button class="logout">로그아웃</button>
</div>
</header>
<nav>
<div class="status-nav">
<ul class="nav-btn">
<li class="nav-item"><a class="nav-order" href="/orderview/ordercopy.html">주문</a></li>
<li class="nav-item"><a class="nav-menu" href="/menu-view/menu.html">메뉴</a></li>
<li class="nav-item"><a class="nav-manage" href="/ambitious-lion-common/SalesManagementPage/manage.html">매출</a></li>
</ul>
</div>
<div class="triangle"></div>
</nav>
<div id="main-board">
<div id="status-nav">
<ul id="nav-btn">
<li id="nav-item">
<a id="nav-link" href="#">전체</a>
</li>
<li id="nav-item">
<a id="nav-link" href="#">판매중</a>
</li>
<li id="nav-item">
<a id="nav-link" href="#">품절</a>
</li>
</ul>
<input type="button"
id = "add-btn"
value = "상품 추가">
</div>
<div id="list-menu">
<ul id="card-list">
<!-- <li id="card-item">
<img id="card-img" src = "./assets/야심작_버거.png">
<span id="item-name">야심작 버거</span>
<span id="card-price">8000</span>
<span id="card-category">햄버거</span>
</li> -->
</ul>
</div>
</div>
<div id="modal-wrap">
<div id="modal-body">
<div id="modal-content">
<span id="close-btn">
<svg xmlns="http://www.w3.org/2000/svg"
width="32"
height="33"
viewBox="0 0 32 33"
fill="none">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M26.3302 31.7199C27.1154 32.5264 28.4112 32.5264 29.1963 31.7199L30.4591 30.4228C31.215 29.6463 31.215 28.409 30.4591 27.6326L21.0134 17.9301C20.2575 17.1536 20.2575 15.9163 21.0134 15.1398L30.4591 5.43735C31.215 4.66087 31.215 3.42359 30.4591 2.64711L29.1963 1.34999C28.4112 0.543492 27.1154 0.543492 26.3302 1.34999L15.7362 12.232L5.14212 1.35C4.35696 0.543496 3.06118 0.543497 2.27602 1.35L1.01324 2.64711C0.257306 3.42359 0.257305 4.66087 1.01324 5.43736L10.4589 15.1398C11.2149 15.9163 11.2149 17.1536 10.4589 17.9301L1.01324 27.6326C0.257306 28.409 0.257306 29.6463 1.01324 30.4228L2.27602 31.7199C3.06118 32.5264 4.35696 32.5264 5.14212 31.7199L15.7362 20.8379L26.3302 31.7199Z"
fill="white"/>
</svg>
</span>
<div id="item-detail">
<p id="modal-title">상품 상세</p>
<hr />
<form>
<div id="form-img">
<div id="img-view">
<img class="item-img">
</div>
<div id="btn-wrap">
<label for="img-add">
<div id="btn-text">
등록
</div>
</label>
<input type="file"
id="img-add"
accept="image/*"
onchange="loadFile(this)";
>
<label for="img-del">
<div id="btn-text">
삭제
</div>
</label>
<input type="button"
id="img-del"
onclick="delFile()";
>
</div>
</div>
<div id="form-text">
<div id="text-group">
<div id="item-group">
<span id="input-title">상품그룹</span>
<div class="dropdown">
<input type="text" class="dropbtn" name="pd_category"value="상품그룹 선택" onclick="dropdown()">
<div id="select-text">
<!--<span class="card-category">상품그룹 선택</span>-->
<!--<span class="dropbtn_click" style="font-family: Material Icons; color : #3b3b3b; float:right;"
>arrow_drop_down</span>-->
</div>
</input>
<div class="dropdown-content">
<div class="menu-list" onclick="showMenu(this.innerText)">버거</div>
<div class="menu-list" onclick="showMenu(this.innerText)">사이드</div>
<div class="menu-list" onclick="showMenu(this.innerText)">음료</div>
</div>
</div>
</div>
<br>
<div id="item-title">
<span id="input-title">상품명</span>
<input type="text" placeholder="상품명 입력" name="pd_name" value="">
</div>
<br>
<div id="item-price">
<span id="input-title">가격</span>
<input type="text" placeholder="가격 입력" name="pd_price" value="">
</div>
<br>
</div>
<div id="item-status">
<span id="status-title">상태</span>
<div id="toggle">
<label id="toggle-wrap">
<span id="result">판매중</span>
<input role="switch" id="toggle-checkbox" type="checkbox" onclick="is_checked()">
</label>
</div>
</div>
<br>
</div>
</form>
<div id="form-btn">
<hr>
<input
role="switch"
type="button"
id="edit-btn"
value="수정"
>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// main board
data = {
data: {
products: [
{
id: 1,
category: {
id: 1,
name: "햄버거",
},
name: "야심작 버거",
image_url: "https://thumb.mt.co.kr/06/2021/03/2021030517294890953_1.jpg/dims/optimize/",
price: 8000,
is_soldout: true,
},
{
id: 99,
category: {
id: 3,
name: "음료",
},
name: "불멸의 에너지",
image_url: "https://images.unsplash.com/photo-1581927692308-be9e43b4d860?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=774&q=80",
price: 12000,
is_soldout: false,
},
],
page: 1,
},
};
console.log(data);
// HTML 렌더링 함수
function renderHTML(data) {
var productList = data.data.products;
var productContainer = document.getElementById('card-list');
for (var i = 0; i < productList.length; i++) {
var product = productList[i];
// 상품 정보 표시
var productDiv = document.createElement('li');
productDiv.setAttribute("id", "card-item");
productDiv.innerHTML = `
<img id=card-img src="${product.image_url}" alt="${product.name}" />
<span id="item-name">${product.name}</span>
<span id="card-price">${product.price}</span>
<span id="card-category">${product.category.name}</span>
`;
// 상품 컨테이너에 추가
productContainer.appendChild(productDiv);
}
}
// 렌더링 실행
renderHTML(data);
</script>
</body>
</html>