feat
This commit is contained in:
parent
6a84f9e55b
commit
c0527681d5
@ -207,7 +207,12 @@
|
||||
{{ competition.style() }}
|
||||
{{ profile_nav.style() }}
|
||||
{{card.style()}}
|
||||
<style>/* Base (common) styles */
|
||||
<style>
|
||||
.b_wy3rt { cursor: pointer; box-shadow: 0 4px 14px -4px rgba(95,23,152,.5); transition: transform .18s, box-shadow .18s, background .18s; }
|
||||
.b_wy3rt:hover { background: #6d1ba9; transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(95,23,152,.6); }
|
||||
.b_wy3rt:active { transform: translateY(0); box-shadow: 0 4px 12px -4px rgba(95,23,152,.5); }
|
||||
@media (prefers-reduced-motion: reduce) { .b_wy3rt:hover, .b_wy3rt:active { transform: none; } }
|
||||
/* Base (common) styles */
|
||||
.c_aihm6{width: 100%;}
|
||||
.mw{margin: 0 20px;
|
||||
width: 100%;}
|
||||
|
||||
@ -313,7 +313,12 @@ async function btnSend(btn, itemId, sender, too){
|
||||
{{ header.style() }}
|
||||
{{ competition.style() }}
|
||||
{{ profile_nav.style() }}
|
||||
<style>/* Base (common) styles */
|
||||
<style>
|
||||
.b_wy3rt { cursor: pointer; box-shadow: 0 4px 14px -4px rgba(95,23,152,.5); transition: transform .18s, box-shadow .18s, background .18s; }
|
||||
.b_wy3rt:hover { background: #6d1ba9; transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(95,23,152,.6); }
|
||||
.b_wy3rt:active { transform: translateY(0); box-shadow: 0 4px 12px -4px rgba(95,23,152,.5); }
|
||||
@media (prefers-reduced-motion: reduce) { .b_wy3rt:hover, .b_wy3rt:active { transform: none; } }
|
||||
/* Base (common) styles */
|
||||
.c_aihm6{width: 100%;}
|
||||
.mw{margin: 0 20px;
|
||||
width: 100%;}
|
||||
@ -407,13 +412,13 @@ picture > img {
|
||||
|
||||
.c_xhd5k:focus, .c_4ykpn:focus {border-color: #5F1798;outline: none;box-shadow: 0 0 0 3px rgba(95, 23, 152, 0.15);}
|
||||
|
||||
.c_aq9et {
|
||||
.b_wy3rt {
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s linear, box‑shadow 0.1s linear;
|
||||
box-shadow: 0 0 0 rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.c_aq9et:active {
|
||||
.b_wy3rt:active {
|
||||
transform: scale(0.9);
|
||||
box-shadow: 5px 5px 5px rgba(95, 23, 152, 0.32);
|
||||
}
|
||||
@ -422,7 +427,7 @@ article>a{width: 100%;}
|
||||
picture>img{ width: 100%; object-fit: scale-down; }
|
||||
.fl{display: flex;justify-content: space-between;width: 100%;}
|
||||
.c_som9s { color: #FFF; font-family: Inter; font-size: 14px; font-style: normal; font-weight: 400; line-height: normal; }
|
||||
.c_aq9et { display: flex; padding: 19px 33px; justify-content: center; align-items: center; align-self: stretch; border-radius: 5px; background: #5F1798; }
|
||||
.b_wy3rt { display: flex; padding: 19px 33px; justify-content: center; align-items: center; align-self: stretch; border-radius: 5px; background: #5F1798; }
|
||||
.b_ornr9 { align-self: stretch; height: 400px; overflow: hidden;}
|
||||
.b_0jst1 { color: #0ED646; font-family: Inter; font-size: 12px; font-style: normal; font-weight: 700; line-height: normal; }
|
||||
.b_vabj9 { align-items: center; background: rgba(14, 214, 70, 0.20); border-radius: 30px; display: flex; justify-content: center; padding: 1.5px 10px; }
|
||||
|
||||
@ -603,7 +603,12 @@ async function btnSend(btn, itemId, sender, too){
|
||||
{% block head %}
|
||||
{{ header.style() }}
|
||||
{{ profile_nav.style() }}
|
||||
<style>/* Base (common) styles */
|
||||
<style>
|
||||
.b_wy3rt { cursor: pointer; box-shadow: 0 4px 14px -4px rgba(95,23,152,.5); transition: transform .18s, box-shadow .18s, background .18s; }
|
||||
.b_wy3rt:hover { background: #6d1ba9; transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(95,23,152,.6); }
|
||||
.b_wy3rt:active { transform: translateY(0); box-shadow: 0 4px 12px -4px rgba(95,23,152,.5); }
|
||||
@media (prefers-reduced-motion: reduce) { .b_wy3rt:hover, .b_wy3rt:active { transform: none; } }
|
||||
/* Base (common) styles */
|
||||
.c_aihm6{width: 100%;}
|
||||
.mw{margin: 0 20px;
|
||||
width: 100%;}
|
||||
|
||||
@ -102,6 +102,11 @@
|
||||
<span class="b_al8e7">Получить</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if doc.status in ['Возврат художнику']%}
|
||||
<button class="b_wy3rt" onclick="btnSend(this, '{{post.d_id}}', '{{user._id}}')">
|
||||
<span class="b_bvl0d">Отправить</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
@ -193,6 +198,93 @@ async function btnAccept(btn, itemId){
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
async function btnSend(btn, itemId, sender){
|
||||
const figcaption = btn.parentElement;
|
||||
const statusDiv = figcaption.querySelectorAll('div')[0];
|
||||
const statusSpan = statusDiv.querySelector('span')
|
||||
|
||||
|
||||
const delivery_type = document.getElementById('delivery_type').value;
|
||||
const trackValue = document.getElementById('track');
|
||||
|
||||
let track = ''
|
||||
if (delivery_type === 'СДЭК' && trackValue) {
|
||||
track = trackValue.value
|
||||
}
|
||||
const requiredInputs = document.querySelectorAll('input[required]');
|
||||
const requiredTextareas = document.querySelectorAll('textarea[required]');
|
||||
const requiredFields = [...requiredInputs, ...requiredTextareas];
|
||||
|
||||
let firstErrorField = null;
|
||||
let hasError = false;
|
||||
|
||||
requiredFields.forEach(field => {
|
||||
const group = field.closest('.floating-group');
|
||||
if (!group) return; // skip if no group wrapper
|
||||
|
||||
let isEmpty = false;
|
||||
if (field.type === 'file') {
|
||||
isEmpty = !field.files || field.files.length === 0;
|
||||
} else {
|
||||
isEmpty = !field.value || !field.value.trim();
|
||||
}
|
||||
|
||||
if (isEmpty) {
|
||||
group.classList.add('error');
|
||||
hasError = true;
|
||||
showToast({message: field.dataset.toast, duration:2500});
|
||||
if (!firstErrorField) firstErrorField = field;
|
||||
} else {
|
||||
group.classList.remove('error');
|
||||
}
|
||||
});
|
||||
|
||||
if (hasError && firstErrorField) {
|
||||
firstErrorField.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
setTimeout(() => firstErrorField.focus(), 600);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/delivery/send', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
sender,
|
||||
item: itemId,
|
||||
delivery_type,
|
||||
track: track
|
||||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
let errorMessage = 'Ошибка сохранения';
|
||||
try {
|
||||
const errorData = await res.json();
|
||||
errorMessage = errorData.detail || errorMessage;
|
||||
} catch (e) {
|
||||
// If response isn't JSON, try to get text
|
||||
try {
|
||||
const errorText = await res.text();
|
||||
errorMessage = errorText || errorMessage;
|
||||
} catch (e) {
|
||||
// Fallback to generic error
|
||||
}
|
||||
}
|
||||
showToast({ message: errorMessage, duration: 2500 });
|
||||
return;
|
||||
}
|
||||
statusDiv.className = 'b_thlt1_2';
|
||||
statusSpan.className = 'b_5dr47_2';
|
||||
statusSpan.textContent = 'Ожидает получения';
|
||||
btn.style.display = 'none'
|
||||
} catch (error) {
|
||||
console.error('Network error:', error);
|
||||
showToast({ message: 'Не удалось подключиться к серверу', duration: 2500 });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
{{ footer.section(user) }}
|
||||
{% endblock %}
|
||||
|
||||
@ -201,6 +293,10 @@ async function btnAccept(btn, itemId){
|
||||
{{ profile_nav.style() }}
|
||||
{{ competition.style() }}
|
||||
<style>
|
||||
.b_wy3rt { cursor: pointer; box-shadow: 0 4px 14px -4px rgba(95,23,152,.5); transition: transform .18s, box-shadow .18s, background .18s; }
|
||||
.b_wy3rt:hover { background: #6d1ba9; transform: translateY(-2px); box-shadow: 0 10px 24px -6px rgba(95,23,152,.6); }
|
||||
.b_wy3rt:active { transform: translateY(0); box-shadow: 0 4px 12px -4px rgba(95,23,152,.5); }
|
||||
@media (prefers-reduced-motion: reduce) { .b_wy3rt:hover, .b_wy3rt:active { transform: none; } }
|
||||
{{label.green()}}
|
||||
{{label.purple()}}
|
||||
#preview_poster{min-height: 456px;}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user