Vaihe 1/4: asiakastyöt (numerointi, tagit, linkit, jäsenet, muutoshistoria)
- Uusi jobs-moduuli: asiakastyön kentät ilman rahakenttiä, juokseva vuosinumero VVVV-NNNN (laskuririvi lukitaan), tagit, linkit dialogissa, jäsenet ja muutoshistoria nimiarvoineen. - Tilojen oikeudet: lasku luotu / laskutettu johto tai työn laskuttaja, arkistointi vain johto; alihankkija näkee vain jäsenyystyönsä eikä muokkaa. - Lista ja haku (numero, nimi, asiakas), suodattimet, omat työt oletuksena, arkistoidut piilossa, myöhässä tekstinä ja kuvakkeena. - Asiakasvalitsin hakuineen ja pikalisäyksineen (myös pikavastaanottoa varten). - Asiakkaan sivulle asiakastyöt-osio; valikkoon Asiakastyöt. - Lukurajapinnat muihin moduuleihin: UserQueries.choices, CustomerQueries.summaries, CatalogQueries.service_units; jobs.*-oikeudet. - Import-linter-sopimukset, käännökset, testit (domain, application, integraatio, selain) sekä määrittelyn ja CLAUDE.md:n päivitys. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from collections.abc import Sequence
|
||||
from collections.abc import Iterable, Sequence
|
||||
from typing import Protocol
|
||||
|
||||
from apps.customers.application.dto import (
|
||||
@@ -25,6 +25,10 @@ class CustomerQueries(Protocol):
|
||||
|
||||
def get_summary(self, customer_id: int) -> CustomerSummary | None: ...
|
||||
|
||||
def summaries(self, customer_ids: Iterable[int]) -> dict[int, CustomerSummary]:
|
||||
"""Many customers at once, keyed by id (for lists in other modules)."""
|
||||
...
|
||||
|
||||
def get_details(
|
||||
self, customer_id: int, *, include_full_personal_id: bool = False
|
||||
) -> CustomerDetails | None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from collections.abc import Sequence
|
||||
from collections.abc import Iterable, Sequence
|
||||
|
||||
from django.db.models import Q
|
||||
|
||||
@@ -43,6 +43,15 @@ class DjangoCustomerQueries:
|
||||
model = CustomerModel.objects.filter(pk=customer_id).first()
|
||||
return _summary(model) if model else None
|
||||
|
||||
def summaries(self, customer_ids: Iterable[int]) -> dict[int, CustomerSummary]:
|
||||
ids = set(customer_ids)
|
||||
if not ids:
|
||||
return {}
|
||||
qs = CustomerModel.objects.filter(pk__in=ids)
|
||||
return {
|
||||
m.pk: _summary(m) for m in qs.only("id", "name", "type", "business_id", "is_internal")
|
||||
}
|
||||
|
||||
def get_details(
|
||||
self, customer_id: int, *, include_full_personal_id: bool = False
|
||||
) -> CustomerDetails | None:
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
{% include "customers/partials/billing_units.html" %}
|
||||
</div>
|
||||
|
||||
{# The jobs module renders this section (no Python dependency from customers to jobs). #}
|
||||
<section id="customer-jobs" class="card bg-base-100 shadow-sm mt-4" aria-labelledby="customer-jobs-heading"
|
||||
hx-get="{% url 'jobs:for_customer' customer.id %}" hx-trigger="load" hx-swap="outerHTML">
|
||||
<div class="card-body">
|
||||
<h2 id="customer-jobs-heading" class="card-title">{% translate "Customer jobs" %}</h2>
|
||||
<p><span class="loading loading-spinner loading-sm" aria-hidden="true"></span> {% translate "Loading…" %}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<dialog id="item-dialog" class="modal" aria-labelledby="item-dialog-title">
|
||||
<div class="modal-box" id="item-dialog-body"></div>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user