Current changes
This commit is contained in:
parent
c6df3a4d0f
commit
63c257e68b
6 changed files with 24 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ venv/
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
localsettings.py
|
localsettings.py
|
||||||
uwsgi.local.sh
|
uwsgi.local.sh
|
||||||
|
config.ini
|
|
@ -15,6 +15,8 @@ from partners.models import Establishment
|
||||||
from payment.models import BillingAddress, Invoice, InvoiceItem, InvoicePayment
|
from payment.models import BillingAddress, Invoice, InvoiceItem, InvoicePayment
|
||||||
from clients.models import ClientProfile
|
from clients.models import ClientProfile
|
||||||
|
|
||||||
|
from payment.demo.models import DemoInvoicePayment # TODO: Remove when no longer needed
|
||||||
|
|
||||||
from .models import Inquiry, Offer
|
from .models import Inquiry, Offer
|
||||||
from .forms import InquiryProcessForm, OfferSelectionForm
|
from .forms import InquiryProcessForm, OfferSelectionForm
|
||||||
|
|
||||||
|
@ -94,7 +96,8 @@ class InquiryPaymentView(View):
|
||||||
invoice = inquiry.invoice
|
invoice = inquiry.invoice
|
||||||
except Invoice.DoesNotExist:
|
except Invoice.DoesNotExist:
|
||||||
invoice = Invoice.from_inquiry(inquiry)
|
invoice = Invoice.from_inquiry(inquiry)
|
||||||
payment_url = InvoicePayment.from_invoice(invoice, inquiry.gateway)
|
# payment_url = InvoicePayment.from_invoice(invoice, inquiry.gateway) # TODO: Make this work again
|
||||||
|
payment_url = DemoInvoicePayment.initiate(invoice)
|
||||||
|
|
||||||
if not payment_url:
|
if not payment_url:
|
||||||
messages.error(request, "Die Zahlung ist leider fehlgeschlagen. Versuche es bitte nochmals!")
|
messages.error(request, "Die Zahlung ist leider fehlgeschlagen. Versuche es bitte nochmals!")
|
||||||
|
|
|
@ -11,7 +11,7 @@ register = template.Library()
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def mapimage(location, zoom=7, width=348, height=250):
|
def mapimage(location, zoom=7, width=348, height=250):
|
||||||
smap = StaticMap(width, height, url_template="http://a.tile.osm.org/{z}/{x}/{y}.png")
|
smap = StaticMap(width, height, url_template="https://tile.openstreetmap.de/{z}/{x}/{y}.png")
|
||||||
marker = CircleMarker((location.x, location.y), color="orange", width=20)
|
marker = CircleMarker((location.x, location.y), color="orange", width=20)
|
||||||
smap.add_marker(marker)
|
smap.add_marker(marker)
|
||||||
image = smap.render(zoom)
|
image = smap.render(zoom)
|
||||||
|
|
|
@ -49,15 +49,20 @@ class RoomCategory(GalleryMixin):
|
||||||
rooms = models.IntegerField(default=0)
|
rooms = models.IntegerField(default=0)
|
||||||
active = models.BooleanField(default=True)
|
active = models.BooleanField(default=True)
|
||||||
|
|
||||||
def average_price(self, date=None):
|
# TODO: Pricing via Pricing objects
|
||||||
dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now()
|
|
||||||
|
|
||||||
return RoomCategoryPricing.for_date(self, dobj).average_price
|
average_price = models.DecimalField(max_digits=12, decimal_places=2)
|
||||||
|
minimum_price = models.DecimalField(max_digits=12, decimal_places=2, default=0)
|
||||||
def minimum_price(self, date=None):
|
|
||||||
dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now()
|
# def average_price(self, date=None):
|
||||||
|
# dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now()
|
||||||
return RoomCategoryPricing.for_date(self, dobj).minimum_price
|
#
|
||||||
|
# return RoomCategoryPricing.for_date(self, dobj).average_price
|
||||||
|
#
|
||||||
|
# def minimum_price(self, date=None):
|
||||||
|
# dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now()
|
||||||
|
#
|
||||||
|
# return RoomCategoryPricing.for_date(self, dobj).minimum_price
|
||||||
|
|
||||||
class RoomCategoryPricing(models.Model):
|
class RoomCategoryPricing(models.Model):
|
||||||
roomcategory = models.ForeignKey(RoomCategory, models.CASCADE)
|
roomcategory = models.ForeignKey(RoomCategory, models.CASCADE)
|
||||||
|
|
|
@ -88,7 +88,8 @@ class Invoice(models.Model):
|
||||||
bottom_tip += "Dokument erstellt: %s" % str(timezone.now())
|
bottom_tip += "Dokument erstellt: %s" % str(timezone.now())
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
"type": InvoiceTypeChoices._value2label_map_[self.type],
|
# "type": InvoiceTypeChoices._value2label_map_[self.type], # TODO: Make this work again
|
||||||
|
"type": "Rechnung",
|
||||||
"object": self,
|
"object": self,
|
||||||
"bottom_tip": bottom_tip
|
"bottom_tip": bottom_tip
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bootstrap4 %}
|
{% load bootstrap4 %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load distance %}
|
||||||
|
|
||||||
{% block "styles" %}
|
{% block "styles" %}
|
||||||
<link rel="stylesheet" type="text/css" href="{% static "vendor/css/jquery.dataTables.min.css" %}">
|
<link rel="stylesheet" type="text/css" href="{% static "vendor/css/jquery.dataTables.min.css" %}">
|
||||||
|
@ -30,10 +31,10 @@
|
||||||
<td>Gebotener Betrag</td>
|
<td>Gebotener Betrag</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</thead>
|
</thead>
|
||||||
{% for inquiry in object_list %}{% if inquiry.is_paid and inquiry.destination_radius == 0 or inquiry.distance.m < inquiry.destination_radius %}
|
{% for inquiry in object_list %}{% distance inquiry.destination_coords establishment.coords as distance %}{% if inquiry.is_paid and inquiry.destination_radius == 0 or distance < inquiry.destination_radius %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ inquiry.id }}</td>
|
<td>{{ inquiry.id }}</td>
|
||||||
<td>{{ inquiry.destination_name }} ({{ inquiry.distance.km | floatformat:1 }}km)</td>
|
<td>{{ inquiry.destination_name }} ({{ distance | floatformat:0 }}m)</td>
|
||||||
<td>{{ inquiry.arrival }}</td>
|
<td>{{ inquiry.arrival }}</td>
|
||||||
<td>{% if inquiry.min_nights == 0 %}Egal!{% elif inquiry.min_nights == 1 %}Kurztrip (2-3 Nächte){% else %}Min. 3 Nächte{% endif %}</td>
|
<td>{% if inquiry.min_nights == 0 %}Egal!{% elif inquiry.min_nights == 1 %}Kurztrip (2-3 Nächte){% else %}Min. 3 Nächte{% endif %}</td>
|
||||||
<td>{{ inquiry.adults }} + {{ inquiry.children }}</td>
|
<td>{{ inquiry.adults }} + {{ inquiry.children }}</td>
|
||||||
|
|
Loading…
Reference in a new issue