draftFromArticle function

CartItemDraft? draftFromArticle(
  1. PosArticle a
)

Was aus einer Kachel im Korb wird; null, wenn die Kachel nicht buchbar ist.

Implementation

CartItemDraft? draftFromArticle(PosArticle a) {
  final satz = a.vatRate == null ? null : vatRateFor(a.vatRate!);
  final preis = a.unitPriceCents;
  if (satz == null || preis == null || preis < 0) return null;
  return CartItemDraft(
    name: a.name,
    unitPriceCents: preis,
    vatRate: satz,
    maxQuantity: a.maxQuantity?.toInt(),
    articleId: artikelIdOderNull(a.id),
  );
}