from django.utils.translation import gettext_lazy as _ from apps.jobs.domain.enums import JobKind, JobStatus, PaymentBasis, Priority STATUS_LABELS = { JobStatus.PROSPECT: _("Prospect"), JobStatus.TENTATIVE: _("Tentative"), JobStatus.QUOTE_REQUEST: _("Quote request"), JobStatus.ORDER: _("Order"), JobStatus.IN_PRODUCTION: _("In production"), JobStatus.ON_HOLD: _("On hold"), JobStatus.DONE: _("Done"), JobStatus.INVOICED: _("Invoice created"), JobStatus.BILLED: _("Invoiced"), JobStatus.ARCHIVED: _("Archived"), } PRIORITY_LABELS = { Priority.WAITING: _("Waiting"), Priority.NORMAL: _("Normal"), Priority.FIRST: _("First"), Priority.URGENT: _("Urgent"), Priority.IMMEDIATE: _("Immediately"), } # daisyUI badge classes; the text and icon always carry the meaning too. PRIORITY_CLASSES = { Priority.WAITING: "badge-info badge-soft", Priority.NORMAL: "badge-success badge-soft", Priority.FIRST: "badge-warning badge-soft", Priority.URGENT: "badge-error badge-soft", Priority.IMMEDIATE: "badge-error priority-immediate", } KIND_LABELS = { JobKind.SERVICE: _("Service job"), JobKind.ONE_OFF: _("One-off"), JobKind.FIXED_TERM: _("Fixed-term"), JobKind.ONGOING: _("Ongoing"), } PAYMENT_BASIS_LABELS = { PaymentBasis.PRICE_LIST: _("Fixed price list"), PaymentBasis.FIXED_QUOTE: _("Fixed, based on a quote"), PaymentBasis.MONTHLY_FEE: _("Fixed monthly fee"), PaymentBasis.HOURLY: _("Hourly"), PaymentBasis.NOT_BILLABLE: _("Not billable"), } ENUM_LABELS = { "status": STATUS_LABELS, "priority": PRIORITY_LABELS, "kind": KIND_LABELS, "payment_basis": PAYMENT_BASIS_LABELS, } # Change history field names (keys from the application layer's FIELD_KEYS, plus links). FIELD_LABELS = { "name": _("Name"), "customer": _("Customer"), "service_units": _("Service units"), "description": _("Description"), "starts_on": _("Start date"), "due_on": _("Due date"), "planned_from": _("Planned start"), "planned_to": _("Planned end"), "kind": _("Kind"), "status": _("Status"), "priority": _("Priority"), "payment_basis": _("Payment basis"), "estimated_hours": _("Estimated hours"), "customer_reference": _("Customer reference (PO)"), "instructions": _("Instructions"), "responsible_user": _("Responsible person"), "contact_user": _("Contact person"), "customer_contact": _("Customer's contact"), "biller_user": _("Biller"), "billing_unit": _("Billing unit"), "members": _("Other members"), "tags": _("Tags"), "links": _("Links"), } DATE_FIELDS = frozenset({"starts_on", "due_on", "planned_from", "planned_to"}) ERROR_MESSAGES = { "invalid_job_name": _("Enter a name (at most 200 characters)."), "invalid_estimated_hours": _("Enter hours between 0 and 9999.99."), "invalid_tag_name": _("A tag is at most 50 characters and contains no commas."), "invalid_link_url": _("Enter a web address starting with http:// or https://."), "invalid_link_title": _("Enter a title of at most 200 characters."), "service_unit_required": _("Choose at least one service unit."), "service_unit_not_selectable": _("A chosen service unit is no longer in use."), "planned_range_invalid": _("The planned end cannot be before the planned start."), "due_before_start": _("The due date cannot be before the start date."), "status_not_allowed": _("You are not allowed to set this status."), "customer_job_not_found": _("The job was not found."), "job_link_not_found": _("The link was not found."), "unknown_customer": _("Choose a customer."), "contact_not_of_customer": _("Choose a contact of the selected customer."), "billing_unit_not_of_customer": _("Choose a billing unit of the selected customer."), "user_not_selectable": _("Choose an active user."), "*": _("The change could not be saved."), }