profiles.typ 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #import "/.template/lib/domain/parties.typ": recipient, party, signer
  2. #import "/.template/lib/presentation/profiles/index.typ" as profiles
  3. #import "/.template/lib/shared/numbering.typ": attachment_numbering
  4. #let run() = {
  5. let addressee = recipient(company: "ООО «Адресат»")
  6. let letter = profiles.letter(recipient: addressee)
  7. assert.eq(letter.id, "letter")
  8. assert.eq(((letter.validate)(letter.metadata)).recipient.kind, "recipient")
  9. let offer = profiles.commercial_offer(
  10. recipient: addressee,
  11. subject: "Предмет",
  12. amount: "100",
  13. )
  14. assert.eq(offer.id, "commercial-offer")
  15. assert.eq(((offer.validate)(offer.metadata)).terms.amount, "100")
  16. let left = party(
  17. "left",
  18. "Исполнитель",
  19. "ООО «Исполнитель»",
  20. representative: signer("И.И. Исполнитель", "Директор"),
  21. )
  22. let right = party(
  23. "right",
  24. "Заказчик",
  25. "ООО «Заказчик»",
  26. representative: signer("З.З. Заказчик", "Директор"),
  27. )
  28. let contract = profiles.contract(
  29. number: "1",
  30. parties: (left, right),
  31. sections: (
  32. profiles.contract_section("subject", "Предмет", [Текст раздела]),
  33. ),
  34. )
  35. assert.eq(contract.id, "contract")
  36. assert.eq(((contract.validate)(contract.metadata)).sections.len(), 1)
  37. assert.eq(attachment_numbering("arabic", 2), "2")
  38. assert.eq(attachment_numbering("cyrillic", 2), "Б")
  39. assert.eq(attachment_numbering("none", 2), "")
  40. "ok"
  41. }