Refactor order creation and add configuration endpoints
Refactored order creation logic to use new serializers and transaction handling, improving validation and modularity. Introduced admin and public endpoints for shop configuration with sensitive fields protected. Enhanced Zásilkovna (Packeta) integration, including packet widget template, new API fields, and improved error handling. Added django-silk for profiling, updated requirements and settings, and improved frontend Orval config for API client generation.
This commit is contained in:
47
backend/thirdparty/zasilkovna/templates/zasilkovna/pickup_point_widget.html
vendored
Normal file
47
backend/thirdparty/zasilkovna/templates/zasilkovna/pickup_point_widget.html
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{% load static %}
|
||||
<script src="https://widget.packeta.com/v6/www/js/library.js"></script>
|
||||
|
||||
<input type="hidden" id="packetaApiKey" value="{{ packeta_Api_Key }}">
|
||||
|
||||
<script>
|
||||
const packetaApiKey = document.querySelector('#packetaApiKey').value;
|
||||
|
||||
const packetaOptions = {
|
||||
country: "cz,sk",
|
||||
language: "cs",
|
||||
valueFormat: "\"Packeta\",id,carrierId,carrierPickupPointId,name,city,street",
|
||||
view: "modal",
|
||||
vendors: [
|
||||
{
|
||||
country: "cz",
|
||||
group: "zbox",
|
||||
price: 45,
|
||||
selected: true
|
||||
},
|
||||
{
|
||||
country: "cz",
|
||||
price: 45,
|
||||
selected: true
|
||||
}
|
||||
],
|
||||
defaultCurrency: "CZK",
|
||||
defaultPrice: "45"
|
||||
};
|
||||
|
||||
|
||||
|
||||
function showSelectedPickupPoint(point) {
|
||||
const saveElement = document.querySelector(".packeta-selector-value");
|
||||
// Add here an action on pickup point selection
|
||||
saveElement.innerText = '';
|
||||
if (point) {
|
||||
console.log("Selected point", point);
|
||||
saveElement.innerText = "point: " + JSON.stringify(point, null, 4); // DŮLEŽITÉ PRO DALŠÍ ZPRACOVÁNÍ (jenom potřebuji ID)
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<button class="packeta-selector-open"
|
||||
onclick="Packeta.Widget.pick(packetaApiKey, showSelectedPickupPoint, packetaOptions)">Select pick-up point</button>
|
||||
<div class="packeta-selector-value"></div>
|
||||
Reference in New Issue
Block a user