Compare commits
7 Commits
a9c1135639
...
6f1886bca2
Author | SHA1 | Date |
---|---|---|
Lukáš Kucharczyk | 6f1886bca2 | |
Lukáš Kucharczyk | 37169c4f9b | |
Lukáš Kucharczyk | 1c73268258 | |
Lukáš Kucharczyk | 3063a3d143 | |
Lukáš Kucharczyk | b589199ca6 | |
Lukáš Kucharczyk | 2fc661dade | |
Lukáš Kucharczyk | 1f535a6e84 |
|
@ -1539,8 +1539,8 @@ input:checked + .toggle-bg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-80 {
|
.max-w-\[30rem\] {
|
||||||
max-width: 20rem;
|
max-width: 30rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-screen-lg {
|
.max-w-screen-lg {
|
||||||
|
@ -1559,18 +1559,6 @@ input:checked + .toggle-bg {
|
||||||
max-width: 20rem;
|
max-width: 20rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-\[90\] {
|
|
||||||
max-width: 90;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-w-\[90rem\] {
|
|
||||||
max-width: 90rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-w-\[30rem\] {
|
|
||||||
max-width: 30rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1 1 0%;
|
flex: 1 1 0%;
|
||||||
}
|
}
|
||||||
|
@ -1750,22 +1738,10 @@ input:checked + .toggle-bg {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-wrap {
|
|
||||||
text-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-nowrap {
|
|
||||||
text-wrap: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-balance {
|
.text-balance {
|
||||||
text-wrap: balance;
|
text-wrap: balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-pretty {
|
|
||||||
text-wrap: pretty;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rounded {
|
.rounded {
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
|
@ -3212,6 +3188,10 @@ textarea:disabled:is(.dark *) {
|
||||||
border-end-end-radius: 0.5rem;
|
border-end-end-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.\[\&_\:last-child\]\:text-right :last-child {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.\[\&_a\]\:underline a {
|
.\[\&_a\]\:underline a {
|
||||||
text-decoration-line: underline;
|
text-decoration-line: underline;
|
||||||
}
|
}
|
||||||
|
@ -3227,3 +3207,7 @@ textarea:disabled:is(.dark *) {
|
||||||
.\[\&_h1\]\:mb-2 h1 {
|
.\[\&_h1\]\:mb-2 h1 {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.\[\&_td\]\:last-of-type\:text-right:last-of-type td {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
<script src="https://cdn.jsdelivr.net/npm/flowbite@2.4.1/dist/flowbite.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/flowbite@2.4.1/dist/flowbite.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||||
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||||
document.documentElement.classList.add('dark');
|
document.documentElement.classList.add('dark');
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.classList.remove('dark')
|
document.documentElement.classList.remove('dark')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body hx-indicator="#indicator">
|
<body hx-indicator="#indicator">
|
||||||
|
@ -45,46 +45,46 @@
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
<script>
|
<script>
|
||||||
var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
|
var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
|
||||||
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
|
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
|
||||||
|
|
||||||
// Change the icons inside the button based on previous settings
|
// Change the icons inside the button based on previous settings
|
||||||
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||||
themeToggleLightIcon.classList.remove('hidden');
|
themeToggleLightIcon.classList.remove('hidden');
|
||||||
} else {
|
|
||||||
themeToggleDarkIcon.classList.remove('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
var themeToggleBtn = document.getElementById('theme-toggle');
|
|
||||||
|
|
||||||
themeToggleBtn.addEventListener('click', function () {
|
|
||||||
|
|
||||||
// toggle icons inside button
|
|
||||||
themeToggleDarkIcon.classList.toggle('hidden');
|
|
||||||
themeToggleLightIcon.classList.toggle('hidden');
|
|
||||||
|
|
||||||
// if set via local storage previously
|
|
||||||
if (localStorage.getItem('color-theme')) {
|
|
||||||
if (localStorage.getItem('color-theme') === 'light') {
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
localStorage.setItem('color-theme', 'dark');
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.remove('dark');
|
|
||||||
localStorage.setItem('color-theme', 'light');
|
|
||||||
}
|
|
||||||
|
|
||||||
// if NOT set via local storage previously
|
|
||||||
} else {
|
} else {
|
||||||
if (document.documentElement.classList.contains('dark')) {
|
themeToggleDarkIcon.classList.remove('hidden');
|
||||||
document.documentElement.classList.remove('dark');
|
|
||||||
localStorage.setItem('color-theme', 'light');
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
localStorage.setItem('color-theme', 'dark');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
var themeToggleBtn = document.getElementById('theme-toggle');
|
||||||
|
|
||||||
|
themeToggleBtn.addEventListener('click', function () {
|
||||||
|
|
||||||
|
// toggle icons inside button
|
||||||
|
themeToggleDarkIcon.classList.toggle('hidden');
|
||||||
|
themeToggleLightIcon.classList.toggle('hidden');
|
||||||
|
|
||||||
|
// if set via local storage previously
|
||||||
|
if (localStorage.getItem('color-theme')) {
|
||||||
|
if (localStorage.getItem('color-theme') === 'light') {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
localStorage.setItem('color-theme', 'dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
localStorage.setItem('color-theme', 'light');
|
||||||
|
}
|
||||||
|
|
||||||
|
// if NOT set via local storage previously
|
||||||
|
} else {
|
||||||
|
if (document.documentElement.classList.contains('dark')) {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
localStorage.setItem('color-theme', 'light');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
localStorage.setItem('color-theme', 'dark');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -3,16 +3,19 @@
|
||||||
class="[&:first-of-type_button]:rounded-s-lg [&:last-of-type_button]:rounded-e-lg">
|
class="[&:first-of-type_button]:rounded-s-lg [&:last-of-type_button]:rounded-e-lg">
|
||||||
{% if color == "gray" %}
|
{% if color == "gray" %}
|
||||||
<button type="button"
|
<button type="button"
|
||||||
|
title="{{ title }}"
|
||||||
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white">
|
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-blue-500 dark:focus:text-white">
|
||||||
{{ slot }}
|
{{ slot }}
|
||||||
</button>
|
</button>
|
||||||
{% elif color == "red" %}
|
{% elif color == "red" %}
|
||||||
<button type="button"
|
<button type="button"
|
||||||
|
title="{{ title }}"
|
||||||
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-red-500 hover:text-white focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:border-red-700 dark:hover:bg-red-700 dark:focus:ring-blue-500 dark:focus:text-white">
|
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-red-500 hover:text-white focus:z-10 focus:ring-2 focus:ring-blue-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:border-red-700 dark:hover:bg-red-700 dark:focus:ring-blue-500 dark:focus:text-white">
|
||||||
{{ slot }}
|
{{ slot }}
|
||||||
</button>
|
</button>
|
||||||
{% elif color == "green" %}
|
{% elif color == "green" %}
|
||||||
<button type="button"
|
<button type="button"
|
||||||
|
title="{{ title }}"
|
||||||
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-green-500 hover:border-green-600 hover:text-white focus:z-10 focus:ring-2 focus:ring-green-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:border-green-700 dark:hover:bg-green-600 dark:focus:ring-green-500 dark:focus:text-white">
|
class="px-2 py-1 text-xs font-medium text-gray-900 bg-white border border-gray-200 hover:bg-green-500 hover:border-green-600 hover:text-white focus:z-10 focus:ring-2 focus:ring-green-700 focus:text-blue-700 dark:bg-gray-800 dark:border-gray-700 dark:text-white dark:hover:text-white dark:hover:border-green-700 dark:hover:bg-green-600 dark:focus:ring-green-500 dark:focus:text-white">
|
||||||
{{ slot }}
|
{{ slot }}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
class="text-black dark:text-white w-4 h-4">
|
||||||
|
<path fill="currentColor" d="M 43.470703 8.9863281 A 1.50015 1.50015 0 0 0 42.439453 9.4394531 L 16.5 35.378906 L 5.5605469 24.439453 A 1.50015 1.50015 0 1 0 3.4394531 26.560547 L 15.439453 38.560547 A 1.50015 1.50015 0 0 0 17.560547 38.560547 L 44.560547 11.560547 A 1.50015 1.50015 0 0 0 43.470703 8.9863281 z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 477 B |
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
class="text-black dark:text-white w-4 h-4">
|
||||||
|
<path fill="currentColor" d="M 24 5.0507812 C 22.945045 5.0507812 21.890232 5.4877258 21.160156 6.3613281 L 7.0566406 23.257812 C 5.2226244 25.45627 6.8812774 29 9.7441406 29 L 38.255859 29 C 41.119312 29 42.778426 25.453888 40.943359 23.255859 L 26.839844 6.3613281 C 26.109768 5.4877258 25.054955 5.0507812 24 5.0507812 z M 24 8.015625 C 24.194045 8.015625 24.387185 8.105759 24.537109 8.2851562 L 38.638672 25.179688 C 38.977605 25.585659 38.784407 26 38.255859 26 L 9.7441406 26 C 9.2150038 26 9.0213443 25.58723 9.3613281 25.179688 L 23.462891 8.2851562 C 23.612815 8.1057586 23.805955 8.015625 24 8.015625 z M 10.5 33 C 8.0324991 33 6 35.032499 6 37.5 L 6 38.5 C 6 40.967501 8.0324991 43 10.5 43 L 37.5 43 C 39.967501 43 42 40.967501 42 38.5 L 42 37.5 C 42 35.032499 39.967501 33 37.5 33 L 10.5 33 z M 10.5 36 L 37.5 36 C 38.346499 36 39 36.653501 39 37.5 L 39 38.5 C 39 39.346499 38.346499 40 37.5 40 L 10.5 40 C 9.6535009 40 9 39.346499 9 38.5 L 9 37.5 C 9 36.653501 9.6535009 36 10.5 36 z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
class="text-black dark:text-white w-4 h-4">
|
||||||
|
<path fill="currentColor" d="M 26 3 C 20.494917 3 16 7.494921 16 13 C 16 18.505079 20.494917 23 26 23 C 31.505083 23 36 18.505079 36 13 C 36 7.494921 31.505083 3 26 3 z M 26 6 C 29.883764 6 33 9.1162385 33 13 C 33 16.883762 29.883764 20 26 20 C 22.116236 20 19 16.883762 19 13 C 19 9.1162385 22.116236 6 26 6 z M 24.75 9 C 24.273 9 23.862531 9.3366875 23.769531 9.8046875 L 23.269531 12.304688 C 23.210531 12.598688 23.286562 12.903766 23.476562 13.134766 C 23.666562 13.366766 23.95 13.5 24.25 13.5 L 26.25 13.5 C 26.664 13.5 27 13.836 27 14.25 C 27 14.765 26.481 15 26 15 C 25.115 15 24.583922 14.685156 24.544922 14.660156 C 24.085922 14.363156 23.472969 14.489313 23.167969 14.945312 C 22.861969 15.405313 22.986313 16.026031 23.445312 16.332031 C 23.548313 16.400031 24.491 17 26 17 C 27.71 17 29 15.818 29 14.25 C 29 12.733 27.767 11.5 26.25 11.5 L 25.470703 11.5 L 25.570312 11 L 27.5 11 C 28.052 11 28.5 10.552 28.5 10 C 28.5 9.448 28.052 9 27.5 9 L 24.75 9 z M 41.613281 22.019531 C 40.493082 22.029231 39.429184 22.473279 38.484375 23.175781 C 37.470126 23.929243 34.418425 26.208042 31.777344 28.179688 C 31.204622 26.351508 29.505924 25 27.5 25 L 23.107422 25 C 20.296203 25 18.985532 24.772226 17.859375 24.533203 C 16.733218 24.29418 15.646783 24 13.826172 24 C 9.9413941 24 7.0123317 26.492986 5.09375 28.791016 C 3.1751683 31.089045 2.1347656 33.384766 2.1347656 33.384766 A 1.5002787 1.5002787 0 1 0 4.8652344 34.628906 C 4.8652344 34.628906 5.7643161 32.669814 7.3964844 30.714844 C 9.0286527 28.759873 11.25995 27 13.826172 27 C 15.347561 27 16.006735 27.20582 17.236328 27.466797 C 18.465921 27.727774 20.123641 28 23.107422 28 L 27.5 28 C 28.346499 28 29 28.653501 29 29.5 C 29 29.969499 28.794195 30.374296 28.470703 30.646484 C 28.470416 30.646699 28.429688 30.677734 28.429688 30.677734 A 1.5001988 1.5001988 0 0 0 28.345703 30.748047 A 1.5001988 1.5001988 0 0 0 28.34375 30.75 C 28.105295 30.908613 27.816466 31 27.5 31 L 20.5 31 A 1.50015 1.50015 0 1 0 20.5 34 L 27.5 34 C 28.440637 34 29.315307 33.701451 30.041016 33.199219 C 30.042186 33.198409 30.043753 33.198076 30.044922 33.197266 A 1.5001988 1.5001988 0 0 0 30.224609 33.082031 C 30.224609 33.082031 38.775959 26.696426 40.273438 25.583984 A 1.50015 1.50015 0 0 0 40.273438 25.582031 C 40.837627 25.162534 41.309824 25.022381 41.640625 25.019531 C 41.971426 25.016631 42.218287 25.096901 42.560547 25.439453 C 43.150922 26.029324 43.147391 26.935102 42.572266 27.533203 C 37.217133 32.036197 33.848465 35.036886 31.623047 36.794922 C 29.369881 38.574924 28.424996 39 27.5 39 C 23.847885 39 19.80067 38 15.5 38 C 13 38 11.242781 39.343609 10.300781 40.599609 C 9.3587815 41.855609 9.0449219 43.136719 9.0449219 43.136719 A 1.50015 1.50015 0 1 0 11.955078 43.863281 C 11.955078 43.863281 12.141219 43.144391 12.699219 42.400391 C 13.257219 41.656391 14 41 15.5 41 C 19.30733 41 23.336115 42 27.5 42 C 29.402004 42 31.084837 41.044435 33.482422 39.150391 C 35.849764 37.280238 39.175413 34.30991 44.498047 29.833984 A 1.50015 1.50015 0 0 0 44.681641 29.681641 C 44.688541 29.674741 44.690436 29.665143 44.697266 29.658203 L 44.701172 29.662109 L 44.753906 29.607422 A 1.50015 1.50015 0 0 0 45.083984 29.074219 C 46.330485 27.321792 46.248887 24.884269 44.681641 23.318359 C 43.8529 22.488911 42.73348 22.009881 41.613281 22.019531 z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -1,4 +1,4 @@
|
||||||
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 [&_a]:underline [&_a]:underline-offset-4 [&_a]:decoration-2">
|
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 [&_a]:underline [&_a]:underline-offset-4 [&_a]:decoration-2 [&_:last-child]:text-right">
|
||||||
{% if slot %}
|
{% if slot %}
|
||||||
{{ slot }}
|
{{ slot }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -44,16 +44,31 @@ urlpatterns = [
|
||||||
purchase.edit_purchase,
|
purchase.edit_purchase,
|
||||||
name="edit_purchase",
|
name="edit_purchase",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"purchase/<int:purchase_id>/drop",
|
||||||
|
purchase.drop_purchase,
|
||||||
|
name="drop_purchase",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"purchase/<int:purchase_id>/delete",
|
"purchase/<int:purchase_id>/delete",
|
||||||
purchase.delete_purchase,
|
purchase.delete_purchase,
|
||||||
name="delete_purchase",
|
name="delete_purchase",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"purchase/<int:purchase_id>/finish",
|
||||||
|
purchase.finish_purchase,
|
||||||
|
name="finish_purchase",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"purchase/list",
|
"purchase/list",
|
||||||
purchase.list_purchases,
|
purchase.list_purchases,
|
||||||
name="list_purchases",
|
name="list_purchases",
|
||||||
),
|
),
|
||||||
|
path(
|
||||||
|
"purchase/<int:purchase_id>/refund",
|
||||||
|
purchase.refund_purchase,
|
||||||
|
name="refund_purchase",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"purchase/related-purchase-by-edition",
|
"purchase/related-purchase-by-edition",
|
||||||
purchase.related_purchase_by_edition,
|
purchase.related_purchase_by_edition,
|
||||||
|
|
|
@ -103,11 +103,39 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||||
"cotton/button_group.html",
|
"cotton/button_group.html",
|
||||||
{
|
{
|
||||||
"buttons": [
|
"buttons": [
|
||||||
|
{
|
||||||
|
"href": reverse(
|
||||||
|
"finish_purchase", args=[purchase.pk]
|
||||||
|
),
|
||||||
|
"slot": Icon("checkmark"),
|
||||||
|
"title": "Mark as finished",
|
||||||
|
}
|
||||||
|
if not purchase.date_finished
|
||||||
|
else {},
|
||||||
|
{
|
||||||
|
"href": reverse(
|
||||||
|
"drop_purchase", args=[purchase.pk]
|
||||||
|
),
|
||||||
|
"slot": Icon("eject"),
|
||||||
|
"title": "Mark as dropped",
|
||||||
|
}
|
||||||
|
if not purchase.date_dropped
|
||||||
|
else {},
|
||||||
|
{
|
||||||
|
"href": reverse(
|
||||||
|
"refund_purchase", args=[purchase.pk]
|
||||||
|
),
|
||||||
|
"slot": Icon("refund"),
|
||||||
|
"title": "Mark as refunded",
|
||||||
|
}
|
||||||
|
if not purchase.date_refunded
|
||||||
|
else {},
|
||||||
{
|
{
|
||||||
"href": reverse(
|
"href": reverse(
|
||||||
"edit_purchase", args=[purchase.pk]
|
"edit_purchase", args=[purchase.pk]
|
||||||
),
|
),
|
||||||
"slot": Icon("edit"),
|
"slot": Icon("edit"),
|
||||||
|
"title": "Edit",
|
||||||
"color": "gray",
|
"color": "gray",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -115,6 +143,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
||||||
"delete_purchase", args=[purchase.pk]
|
"delete_purchase", args=[purchase.pk]
|
||||||
),
|
),
|
||||||
"slot": Icon("delete"),
|
"slot": Icon("delete"),
|
||||||
|
"title": "Delete",
|
||||||
"color": "red",
|
"color": "red",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -184,7 +213,31 @@ def edit_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
def delete_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
def delete_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
purchase = get_object_or_404(Purchase, id=purchase_id)
|
purchase = get_object_or_404(Purchase, id=purchase_id)
|
||||||
purchase.delete()
|
purchase.delete()
|
||||||
return redirect("list_sessions")
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def drop_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
|
purchase = get_object_or_404(Purchase, id=purchase_id)
|
||||||
|
purchase.date_dropped = timezone.now()
|
||||||
|
purchase.save()
|
||||||
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def refund_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
|
purchase = get_object_or_404(Purchase, id=purchase_id)
|
||||||
|
purchase.date_refunded = timezone.now()
|
||||||
|
purchase.save()
|
||||||
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def finish_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
|
||||||
|
purchase = get_object_or_404(Purchase, id=purchase_id)
|
||||||
|
purchase.date_finished = timezone.now()
|
||||||
|
purchase.save()
|
||||||
|
return redirect("list_purchases")
|
||||||
|
|
||||||
|
|
||||||
def related_purchase_by_edition(request: HttpRequest) -> HttpResponse:
|
def related_purchase_by_edition(request: HttpRequest) -> HttpResponse:
|
||||||
|
|
Loading…
Reference in New Issue