from django.db import models from django.utils.translation import gettext_lazy as _ # Create your models here. class Helper(models.Model): date = models.DateField() ben = models.PositiveSmallIntegerField() best = models.PositiveSmallIntegerField(blank=True, null=True) info = models.TextField(blank=True, null=True) def __str__(self): return f"{self.date} - {self.ben} - {self.best}" class Reinigung(models.Model): class ShiftType(models.TextChoices): Beauftragen = 'Beauftragen' # Placeholder for "None" if you're using it Bestellt = 'Bestellt' date = models.DateField() auftrag = models.CharField( max_length=12, choices=ShiftType.choices, default='', null=True, ) info = models.TextField(blank=True, null=True) def __str__(self): return f"{self.date} - {self.auftrag}" class Employee(models.Model): name = models.CharField(max_length=100) daily_workhours = models.PositiveIntegerField() info = models.TextField(blank=True, null=True) def __str__(self): return self.name class Shift(models.Model): class ShiftType(models.TextChoices): NONE = 'N', _('None') # Placeholder for "None" if you're using it VACATION = 'U', _('Urlaub') CATERING = 'C', _('Catering') SICK = 'K', _('Krank') RB = 'RB', _('Rufbereitschaft') SD = 'SO', _('Sonderdienst') KK = 'KKH', _('KKH') ST = 'ST', _('Stapler') AH = 'AH', _('Ausser Haus') class ShiftChef(models.TextChoices): NONE = '', _('None') # Placeholder for "None" if you're using it CVD = 'D', _('CVD') CVT = 'T', _('CVT') date = models.DateField() start = models.TimeField(null=True, blank=True) end = models.TimeField(null=True, blank=True) shifttype = models.CharField( max_length=3, choices=ShiftType.choices, default=ShiftType.NONE, null=True, ) shiftchef = models.CharField( max_length=3, choices=ShiftChef.choices, default=ShiftChef.NONE, null=True, blank=True ) employee = models.ForeignKey(Employee, on_delete=models.CASCADE) info = models.TextField(null=True, blank=True) def __str__(self): return f"{self.date} - {self.get_shifttype_display()}" class Location(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Event(models.Model): class EventType(models.TextChoices): NONE = '', _('None') AUFBAU = 'AU', _('Aufbau') ABBAU = 'AB', _('Abbau') UMBAU = 'UM', _('Umbau') VATAG = 'VA', _('VA-Tag') SPIELTAG = 'ST', _('Spieltag') TRAINING = 'TR', _('Training') class EventBelegung(models.TextChoices): NONE = '', _('None') HalbeHalle = 'HH', _('Halbe Halle') GanzeHalle = 'GH', _('Ganze Halle') date = models.DateField() name = models.CharField(max_length=100) event_type = models.CharField( max_length=2, choices=EventType.choices, default=EventType.NONE, null=True, ) location = models.ForeignKey(Location, on_delete=models.CASCADE) belegung = models.CharField( max_length=2, choices=EventBelegung.choices, default=EventBelegung.NONE, null=True, ) pax = models.SmallIntegerField(null=True, blank=True) cvd = models.ForeignKey(Employee, related_name='cvt', on_delete=models.SET_NULL, null=True, blank=True) cvt = models.ForeignKey(Employee, related_name='cvd', on_delete=models.SET_NULL, null=True, blank=True) info = models.TextField(null=True, blank=True) def __str__(self): return f"{self.date} - {self.name}"