Spaces:
Running
Running
Update log.html
Browse files
log.html
CHANGED
|
@@ -34,19 +34,9 @@ body{
|
|
| 34 |
.medium{background:#f59e0b;color:white;}
|
| 35 |
.low{background:#10b981;color:white;}
|
| 36 |
|
| 37 |
-
.title{
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
.big{
|
| 43 |
-
font-size:18px;
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
.small{
|
| 47 |
-
font-size:14px;
|
| 48 |
-
color:#6b7280;
|
| 49 |
-
}
|
| 50 |
</style>
|
| 51 |
</head>
|
| 52 |
|
|
@@ -90,7 +80,7 @@ Portions: <span id="portionValue">50</span>
|
|
| 90 |
|
| 91 |
<h2 class="title mb-4">AI Recommendations</h2>
|
| 92 |
|
| 93 |
-
<div id="aiBox"
|
| 94 |
|
| 95 |
<button onclick="runAI()" class="mt-4 bg-emerald-600 text-white px-6 py-2 rounded-full">
|
| 96 |
Ask AI
|
|
@@ -128,7 +118,7 @@ document.getElementById("portions").oninput = e=>{
|
|
| 128 |
document.getElementById("portionValue").innerText = e.target.value;
|
| 129 |
};
|
| 130 |
|
| 131 |
-
/*
|
| 132 |
async function runAI(){
|
| 133 |
|
| 134 |
const res = await fetch(API_URL,{
|
|
@@ -193,22 +183,19 @@ function renderAI(){
|
|
| 193 |
|
| 194 |
/* ACCEPT */
|
| 195 |
function accept(i){
|
| 196 |
-
|
| 197 |
accepted.push(current[i]);
|
| 198 |
current.splice(i,1);
|
| 199 |
-
|
| 200 |
renderAI();
|
| 201 |
renderAccepted();
|
| 202 |
}
|
| 203 |
|
| 204 |
/* REJECT AI */
|
| 205 |
function rejectAI(i){
|
| 206 |
-
|
| 207 |
current.splice(i,1);
|
| 208 |
renderAI();
|
| 209 |
}
|
| 210 |
|
| 211 |
-
/* MATCHED
|
| 212 |
function renderAccepted(){
|
| 213 |
|
| 214 |
if(accepted.length === 0){
|
|
@@ -236,23 +223,25 @@ function renderAccepted(){
|
|
| 236 |
`).join("");
|
| 237 |
}
|
| 238 |
|
| 239 |
-
/* REMOVE
|
| 240 |
function rejectFromMatched(i){
|
| 241 |
accepted.splice(i,1);
|
| 242 |
renderAccepted();
|
| 243 |
}
|
| 244 |
|
| 245 |
-
/* CONFIRM */
|
| 246 |
function confirmDonation(){
|
| 247 |
|
| 248 |
if(accepted.length === 0){
|
| 249 |
-
alert("
|
| 250 |
return;
|
| 251 |
}
|
| 252 |
|
| 253 |
localStorage.setItem("donationData", JSON.stringify({
|
| 254 |
portions: document.getElementById("portions").value,
|
| 255 |
-
|
|
|
|
|
|
|
| 256 |
}));
|
| 257 |
|
| 258 |
window.location.href = "confirmation.html";
|
|
|
|
| 34 |
.medium{background:#f59e0b;color:white;}
|
| 35 |
.low{background:#10b981;color:white;}
|
| 36 |
|
| 37 |
+
.title{font-size:22px;font-weight:800;}
|
| 38 |
+
.big{font-size:18px;}
|
| 39 |
+
.small{font-size:14px;color:#6b7280;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
</style>
|
| 41 |
</head>
|
| 42 |
|
|
|
|
| 80 |
|
| 81 |
<h2 class="title mb-4">AI Recommendations</h2>
|
| 82 |
|
| 83 |
+
<div id="aiBox">Click Ask AI</div>
|
| 84 |
|
| 85 |
<button onclick="runAI()" class="mt-4 bg-emerald-600 text-white px-6 py-2 rounded-full">
|
| 86 |
Ask AI
|
|
|
|
| 118 |
document.getElementById("portionValue").innerText = e.target.value;
|
| 119 |
};
|
| 120 |
|
| 121 |
+
/* AI CALL */
|
| 122 |
async function runAI(){
|
| 123 |
|
| 124 |
const res = await fetch(API_URL,{
|
|
|
|
| 183 |
|
| 184 |
/* ACCEPT */
|
| 185 |
function accept(i){
|
|
|
|
| 186 |
accepted.push(current[i]);
|
| 187 |
current.splice(i,1);
|
|
|
|
| 188 |
renderAI();
|
| 189 |
renderAccepted();
|
| 190 |
}
|
| 191 |
|
| 192 |
/* REJECT AI */
|
| 193 |
function rejectAI(i){
|
|
|
|
| 194 |
current.splice(i,1);
|
| 195 |
renderAI();
|
| 196 |
}
|
| 197 |
|
| 198 |
+
/* MATCHED */
|
| 199 |
function renderAccepted(){
|
| 200 |
|
| 201 |
if(accepted.length === 0){
|
|
|
|
| 223 |
`).join("");
|
| 224 |
}
|
| 225 |
|
| 226 |
+
/* REMOVE MATCHED */
|
| 227 |
function rejectFromMatched(i){
|
| 228 |
accepted.splice(i,1);
|
| 229 |
renderAccepted();
|
| 230 |
}
|
| 231 |
|
| 232 |
+
/* CONFIRM FIXED */
|
| 233 |
function confirmDonation(){
|
| 234 |
|
| 235 |
if(accepted.length === 0){
|
| 236 |
+
alert("Please select at least one recipient.");
|
| 237 |
return;
|
| 238 |
}
|
| 239 |
|
| 240 |
localStorage.setItem("donationData", JSON.stringify({
|
| 241 |
portions: document.getElementById("portions").value,
|
| 242 |
+
foodType: document.getElementById("foodType").value,
|
| 243 |
+
expiry: document.getElementById("expiry").value,
|
| 244 |
+
accepted: accepted
|
| 245 |
}));
|
| 246 |
|
| 247 |
window.location.href = "confirmation.html";
|