feat
This commit is contained in:
parent
5f6540815f
commit
00a0b25677
@ -31,7 +31,15 @@
|
||||
|
||||
<a class="b_6spaf" href="/profile/delivery/{{doc.post_id}}#main">Посмотреть историю</a>
|
||||
<h2 class="c_9hvtd b_f5fb2">{{doc.title}}</h2>
|
||||
|
||||
{% if doc.status != 'Продано' %}
|
||||
<label class="offer-label delivery-checkbox-label">
|
||||
<input type="checkbox"
|
||||
onchange="saledPaintings('{{doc.post_id}}')"
|
||||
class="offer-checkbox delivery-checkbox send-checkbox"
|
||||
{% if doc.status == 'Продано' %}checked{%endif%}>
|
||||
<span>Продано</span>
|
||||
</label>
|
||||
{% endif %}
|
||||
{% if doc.type == 'exhibition' and doc.get('exhibition') %}
|
||||
<p class="b_6spaf">{{doc.get('exhibition').title}}</p>
|
||||
<div class="b_xz6em">
|
||||
@ -256,6 +264,38 @@
|
||||
<span class="b_bvl0d">Получить выбранные</span>
|
||||
</button>
|
||||
</div>
|
||||
<script>
|
||||
function saledPaintings(postId) {
|
||||
fetch(`/api/post/${postId}/sale`, {
|
||||
method: 'PUT'
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
// Find and delete the parent figure
|
||||
const postElement = document.querySelector(`figure[data-postId='${postId}']`);
|
||||
showToast({
|
||||
message: 'Сохранено!',
|
||||
status: 'info',
|
||||
duration: 1200
|
||||
});
|
||||
} else {
|
||||
showToast({
|
||||
message: 'Ошибка соединения с сервером!',
|
||||
status: 'error',
|
||||
duration: 2500
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// Handle network errors
|
||||
showToast({
|
||||
message: 'Ошибка соединения с сервером!',
|
||||
status: 'error',
|
||||
duration: 2500
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// ─────────────────────────────────────────────
|
||||
// Helpers: collect selected IDs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user