diff --git a/apps/note/templates/sheets/order.html b/apps/note/templates/sheets/order.html
new file mode 100644
index 00000000..2511c2de
--- /dev/null
+++ b/apps/note/templates/sheets/order.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+{% comment %}
+SPDX-License-Identifier: GPL-3.0-or-later
+{% endcomment %}
+{% load crispy_forms_tags %}
+{% load i18n %}
+
+{% block content %}
+
+
+
+ {% crispy form %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/apps/sheets/migrations/0002_auto_20220818_1713.py b/apps/sheets/migrations/0002_auto_20220818_1713.py
new file mode 100644
index 00000000..ce27c43c
--- /dev/null
+++ b/apps/sheets/migrations/0002_auto_20220818_1713.py
@@ -0,0 +1,34 @@
+# Generated by Django 2.2.27 on 2022-08-18 15:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sheets', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='order',
+ name='gift',
+ ),
+ migrations.AddField(
+ model_name='orderedfood',
+ name='gift',
+ field=models.IntegerField(default=0, verbose_name='gift'),
+ preserve_default=False,
+ ),
+ migrations.AddField(
+ model_name='orderedmeal',
+ name='gift',
+ field=models.IntegerField(default=0, verbose_name='gift'),
+ preserve_default=False,
+ ),
+ migrations.AlterField(
+ model_name='orderedfood',
+ name='status',
+ field=models.CharField(choices=[('QUEUED', 'queued'), ('READY', 'ready'), ('SERVED', 'served'), ('CANCELED', 'canceled')], default='QUEUED', max_length=8, verbose_name='status'),
+ ),
+ ]
diff --git a/apps/sheets/models.py b/apps/sheets/models.py
index 7ae3bce1..c4c47fa2 100644
--- a/apps/sheets/models.py
+++ b/apps/sheets/models.py
@@ -137,7 +137,7 @@ class Meal(models.Model):
)
def __str__(self):
- return self.name
+ return _("meal").capitalize() + " " + self.name
class Meta:
verbose_name = _("meal")
@@ -162,10 +162,6 @@ class Order(models.Model):
auto_now_add=True,
)
- gift = models.IntegerField(
- verbose_name=_("gift"),
- )
-
class Meta:
verbose_name = _("order")
verbose_name_plural = _("orders")
@@ -184,6 +180,10 @@ class OrderedMeal(models.Model):
verbose_name=_("meal"),
)
+ gift = models.IntegerField(
+ verbose_name=_("gift"),
+ )
+
class Meta:
verbose_name = _("ordered meal")
verbose_name_plural = _("ordered meals")
@@ -229,6 +229,10 @@ class OrderedFood(models.Model):
verbose_name=_("priority request"),
)
+ gift = models.IntegerField(
+ verbose_name=_("gift"),
+ )
+
number = models.IntegerField(
verbose_name=_("number"),
help_text=_("How many times the user ordered this."),
@@ -242,6 +246,7 @@ class OrderedFood(models.Model):
('SERVED', _("served")),
('CANCELED', _("canceled")),
],
+ default='QUEUED',
verbose_name=_("status"),
)
@@ -268,14 +273,16 @@ class SheetOrderTransaction(Transaction):
return _("note sheet")
@property
- def price(self):
+ def get_price(self):
if self.ordered_food.meal:
- return sum(ordered_food.price + sum(opt.extra_cost for opt in ordered_food.options.all())
- for ordered_food in self.ordered_food.meal.orderedfood_set.exclude(status='CANCELED').all())
+ return self.ordered_food.meal.meal.price + self.ordered_food.meal.gift + sum(
+ sum(opt.extra_cost for opt in ordered_food.options.all())
+ for ordered_food in self.ordered_food.meal.orderedfood_set.exclude(status='CANCELED').all())
elif self.ordered_food.status == 'CANCELED':
return 0
else:
- return self.ordered_food.food.price + sum(opt.extra_cost for opt in self.ordered_food.options.all())
+ return self.ordered_food.food.price + self.ordered_food.gift \
+ + sum(opt.extra_cost for opt in self.ordered_food.options.all())
class Meta:
verbose_name = _("sheet order transaction")
diff --git a/apps/sheets/templates/sheets/food_form.html b/apps/sheets/templates/sheets/food_form.html
index 0b13f206..e4f12b60 100644
--- a/apps/sheets/templates/sheets/food_form.html
+++ b/apps/sheets/templates/sheets/food_form.html
@@ -1,11 +1,11 @@
-{% extends "wei/base.html" %}
+{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load crispy_forms_tags %}
{% load i18n %}
-{% block profile_content %}
+{% block content %}
diff --git a/apps/sheets/templates/sheets/sheet_form.html b/apps/sheets/templates/sheets/sheet_form.html
index c62fec40..f8a3ed08 100644
--- a/apps/sheets/templates/sheets/sheet_form.html
+++ b/apps/sheets/templates/sheets/sheet_form.html
@@ -1,11 +1,11 @@
-{% extends "wei/base.html" %}
+{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load crispy_forms_tags %}
{% load i18n %}
-{% block profile_content %}
+{% block content %}