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
|
||||
localsettings.py
|
||||
uwsgi.local.sh
|
||||
config.ini
|
|
@ -15,6 +15,8 @@ from partners.models import Establishment
|
|||
from payment.models import BillingAddress, Invoice, InvoiceItem, InvoicePayment
|
||||
from clients.models import ClientProfile
|
||||
|
||||
from payment.demo.models import DemoInvoicePayment # TODO: Remove when no longer needed
|
||||
|
||||
from .models import Inquiry, Offer
|
||||
from .forms import InquiryProcessForm, OfferSelectionForm
|
||||
|
||||
|
@ -94,7 +96,8 @@ class InquiryPaymentView(View):
|
|||
invoice = inquiry.invoice
|
||||
except Invoice.DoesNotExist:
|
||||
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:
|
||||
messages.error(request, "Die Zahlung ist leider fehlgeschlagen. Versuche es bitte nochmals!")
|
||||
|
|
|
@ -11,7 +11,7 @@ register = template.Library()
|
|||
|
||||
@register.simple_tag
|
||||
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)
|
||||
smap.add_marker(marker)
|
||||
image = smap.render(zoom)
|
||||
|
|
|
@ -49,15 +49,20 @@ class RoomCategory(GalleryMixin):
|
|||
rooms = models.IntegerField(default=0)
|
||||
active = models.BooleanField(default=True)
|
||||
|
||||
def average_price(self, date=None):
|
||||
dobj = timezone.datetime.strptime(date, "%Y-%m-%d") if date else timezone.now()
|
||||
# TODO: Pricing via Pricing objects
|
||||
|
||||
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()
|
||||
|
||||
return RoomCategoryPricing.for_date(self, dobj).minimum_price
|
||||
# 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).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):
|
||||
roomcategory = models.ForeignKey(RoomCategory, models.CASCADE)
|
||||
|
|
|
@ -88,7 +88,8 @@ class Invoice(models.Model):
|
|||
bottom_tip += "Dokument erstellt: %s" % str(timezone.now())
|
||||
|
||||
args = {
|
||||
"type": InvoiceTypeChoices._value2label_map_[self.type],
|
||||
# "type": InvoiceTypeChoices._value2label_map_[self.type], # TODO: Make this work again
|
||||
"type": "Rechnung",
|
||||
"object": self,
|
||||
"bottom_tip": bottom_tip
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% load static %}
|
||||
{% load distance %}
|
||||
|
||||
{% block "styles" %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "vendor/css/jquery.dataTables.min.css" %}">
|
||||
|
@ -30,10 +31,10 @@
|
|||
<td>Gebotener Betrag</td>
|
||||
<td></td>
|
||||
</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>
|
||||
<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>{% 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>
|
||||
|
|
Loading…
Reference in a new issue