Value |
array:7 [
"@context" => "/api/contexts/Template"
"@id" => "/api/templates"
"@type" => "hydra:Collection"
"hydra:member" => array:1 [
0 => array:6 [
"@id" => "/api/templates/f47ef469dac34bc29180feb40a25724c"
"@type" => "Template"
"id" => "f47ef469dac34bc29180feb40a25724c"
"name" => "Test"
"customerId" => "customer_121"
"content" => """
<!doctype html>\n
<html lang="fr">\n
<meta charset="utf-8">\n
<meta name="viewport" content="width=device-width, initial-scale=1">\n
<title>Devis – YANIGAV – {{ quote.name|default('Enfonce-pieux HYDROCHOC HPG 790') }}</title>\n
<style>\n
:root { --primary:#0f172a; --muted:#475569; --border:#e2e8f0; --bg:#f8fafc; }\n
html, body { margin:0; padding:0; background:var(--bg); color:#0b1220; font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji"; }\n
.page { max-width:900px; margin:2rem auto; background:#fff; border:1px solid var(--border); border-radius:12px; overflow:hidden; box-shadow:0 10px 30px rgba(0,0,0,.04); }\n
header { padding:1.25rem 1.5rem; background:#fff; border-bottom:1px solid var(--border); display:flex; gap:1rem; align-items:center; }\n
.brand { font-weight:700; letter-spacing:.2px; font-size:1rem; color:var(--primary); }\n
.sub { color:var(--muted); font-size:.9rem; }\n
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }\n
.section { padding:1.25rem 1.5rem; }\n
h1 { font-size:1.4rem; margin:.25rem 0 .5rem; letter-spacing:.2px; }\n
h2 { font-size:1.1rem; margin:0 0 .75rem; color:var(--primary); }\n
p { margin:.25rem 0; line-height:1.55; }\n
.card { background:#fff; border:1px solid var(--border); border-radius:10px; padding:1rem; }\n
.muted { color:var(--muted); }\n
.kvs { display:grid; grid-template-columns:1fr 1fr; gap:.5rem 1rem; font-size:.95rem; }\n
.kvs div { display:flex; align-items:center; gap:.5rem; }\n
.pill { font-size:.8rem; padding:.15rem .5rem; border:1px solid var(--border); border-radius:999px; background:#f1f5f9; }\n
table { width:100%; border-collapse:collapse; }\n
th, td { border:1px solid var(--border); padding:.6rem .5rem; text-align:left; vertical-align:top; }\n
thead th { background:#f1f5f9; }\n
tfoot td { font-weight:600; }\n
.note { font-size:.92rem; background:#f8fafc; border:1px dashed var(--border); padding:.75rem; border-radius:8px; }\n
.cols-3 { columns:2; column-gap:1rem; }\n
.signature { height:80px; border:1px dashed var(--border); border-radius:10px; display:flex; align-items:center; justify-content:center; color:var(--muted); }\n
footer { padding:1rem 1.5rem; border-top:1px solid var(--border); color:var(--muted); font-size:.9rem; background:#fff; }\n
</style>\n
\n
<body>\n
<div class="page">\n
\n
{# ==== Raccourcis / sécurisation des accès ==== #}\n
{% set c = (quote.prospect is defined and quote.prospect.contact is defined) ? quote.prospect.contact : null %}\n
{% set a = (c and c.mainAddress is defined) ? c.mainAddress : null %}\n
{% set comp = (quote.prospect is defined and quote.prospect.company is defined) ? quote.prospect.company : null %}\n
{% set lines = quote.quoteLines|default([]) %}\n
\n
{# Portable du commercial : on cherche dans un ordre sûr #}\n
{% set tel_portable = '' %}\n
{% if managedBy is defined %}\n
{% if managedBy.phoneNumber is defined and managedBy.phoneNumber %}{% set tel_portable = managedBy.phoneNumber %}\n
{% elseif managedBy.mobilePhone is defined and managedBy.mobilePhone %}{% set tel_portable = managedBy.mobilePhone %}\n
{% elseif managedBy.phone is defined and managedBy.phone %}{% set tel_portable = managedBy.phone %}\n
{% endif %}\n
{% endif %}\n
\n
{# ==== Totaux/remise/TVA - robustes ==== #}\n
{% set total_ht_before_discount = 0 %}\n
{% for l in lines %}\n
{% set q = l.quantity|default(1) %}\n
{% set pu = l.unitPriceExclVat|default(0) %}\n
{% set total_ht_before_discount = total_ht_before_discount + (q * pu) %}\n
{% endfor %}\n
{% if total_ht_before_discount == 0 %}\n
{% set total_ht_before_discount = quote.totalExcludingVat|default(0) %}\n
{% endif %}\n
{% set total_ht = quote.totalExcludingVat|default(total_ht_before_discount) %}\n
{% set discount_value = total_ht_before_discount - total_ht %}\n
{% set discount_percent = total_ht_before_discount > 0 ? (discount_value / total_ht_before_discount * 100) : 0 %}\n
{% set vat_total = 0 %}\n
{% for l in lines %}\n
{% set vat_total = vat_total + (l.vatAmount|default(0)) %}\n
{% endfor %}\n
\n
{# ==== Sélection ligne principale / formation / options (sans filtres avancés) ==== #}\n
{% set first = (lines[0] is defined) ? lines[0] : null %}\n
{% set mainLine = null %}\n
{% set formationLine = null %}\n
{% set options = [] %}\n
{% for l in lines %}\n
{% set ref = l.reference|default('')|lower %}\n
{% set isOpt = l.isOptional is defined and l.isOptional %}\n
{% if mainLine is null and not isOpt and ('formation' not in ref) %}\n
{% set mainLine = l %}\n
{% endif %}\n
{% if formationLine is null and ('formation' in ref) %}\n
{% set formationLine = l %}\n
{% endif %}\n
{% if isOpt %}\n
{% set options = options|merge([l]) %}\n
{% endif %}\n
{% endfor %}\n
{% if mainLine is null %}{% set mainLine = first %}{% endif %}\n
\n
<!-- HEADER -->\n
<header>\n
<div style="flex:1">\n
<div class="brand">YANIGAV – Enfonce-pieux • Affûte-piquet • Fendeuse de bûche</div>\n
<div class="sub">RCS ROANNE B 403 872 724 • SIRET 403 872 724 00014 • APE 4661Z • TVA FR114038727224</div>\n
</div>\n
<div class="pill">{{ (quote.createdAt|default('now'))|date('d F Y') }}</div>\n
</header>\n
\n
<!-- COORDONNÉES -->\n
<div class="section grid-2">\n
<div class="card">\n
<h2>Expéditeur</h2>\n
<p><strong>YANIGAV</strong></p>\n
<p>De la part de <strong>{{ managedBy is defined and managedBy.fullname is defined ? managedBy.fullname : (quote.managedByRealName|default('')) }}</strong> ({{ managedBy is defined and managedBy.role is defined and managedBy.role ? managedBy.role : 'Resp. Commercial' }})</p>\n
<div class="kvs">\n
<div><span class="pill">Tél</span> {{ managedBy is defined and managedBy.phone is defined and managedBy.phone ? managedBy.phone : '—' }}</div>\n
{% if tel_portable %}\n
<div><span class="pill">Port</span> {{ tel_portable }}</div>\n
{% endif %}\n
<div><span class="pill">Email</span>\n
{% if managedBy is defined and managedBy.email is defined and managedBy.email %}\n
<a href="mailto:{{ managedBy.email }}">{{ managedBy.email }}</a>\n
{% else %}—{% endif %}\n
</div>\n
</div>\n
</div>\n
<div class="card">\n
<h2>Destinataire</h2>\n
<p><strong>{{ quote.contactIdRealName|default(c and (c.fullname is defined and c.fullname ? c.fullname : (c.name|default('')))) }}</strong></p>\n
{% if comp and comp.name is defined and comp.name %}<p><strong>{{ comp.name }}</strong></p>{% endif %}\n
{% if a and (a.postalCode is defined or a.city is defined) %}<p class="muted">{{ a.postalCode|default('') }} {{ a.city|default('') }}</p>{% endif %}\n
</div>\n
</div>\n
\n
<!-- INTRO -->\n
<div class="section">\n
<div class="card">\n
<h1>Proposition commerciale</h1>\n
<p>{% if c and c.civility is defined and c.civility %}{{ c.civility }},{% else %}Madame, Monsieur,{% endif %}</p>\n
<p>Nous vous remercions de l’intérêt que vous portez à la marque YANIGAV et à ses produits. Suite à votre récent appel téléphonique, voici notre proposition pour un <strong>{{ quote.name|default('Enfonce-pieux HYDROCHOC HPG 790') }}</strong> correspondant à votre demande.</p>\n
{% if quote.priceListRef is defined and quote.priceListRef %}\n
<p class="muted">{{ quote.priceListRef }}</p>\n
{% else %}\n
<p class="muted">Tarif — {{ (quote.createdAt|default('now'))|date('Y') }}</p>\n
{% endif %}\n
</div>\n
</div>\n
\n
<!-- OFFRE PRINCIPALE -->\n
<div class="section">\n
<div class="card">\n
<h2>Offre principale</h2>\n
<table>\n
<thead>\n
<tr>\n
<th>Désignation</th>\n
<th>Référence</th>\n
<th>Prix unitaire HT</th>\n
</tr>\n
</thead>\n
<tbody>\n
{% set pu = (mainLine and mainLine.unitPriceExclVat is defined) ? mainLine.unitPriceExclVat : (total_ht_before_discount > 0 ? total_ht_before_discount : 0) %}\n
<tr>\n
<td>{{ (mainLine and mainLine.name is defined and mainLine.name) ? mainLine.name : quote.name }}</td>\n
<td>{{ (mainLine and mainLine.reference is defined and mainLine.reference) ? mainLine.reference : '—' }}</td>\n
<td>{{ pu|number_format(0, ',', ' ') }} €</td>\n
</tr>\n
</tbody>\n
</table>\n
{% set note = 'Cinématique unique sur le marché — un véritable atout dans les terrains compliqués.' %}\n
<p class="note" style="margin-top:.75rem">{{ note }}</p>\n
</div>\n
</div>\n
\n
{# ==== DESCRIPTION / ÉQUIPEMENT / FORMATION / OPTIONS ==== #}\n
{% set description = (mainLine and mainLine.description is defined and mainLine.description) ? mainLine.description : '' %}\n
{% set description = description|replace({'•':'\n',';':'\n'}) %}\n
{% set descList = description|split('\n') %}\n
\n
<div class="section grid-2">\n
<div class="card">\n
<h2>Points forts</h2>\n
{% set hasPoint = false %}\n
<ul class="cols-3">\n
{% for item in descList %}\n
{% set t = item|trim %}\n
{% if t != '' %}\n
{% set hasPoint = true %}\n
<li>{{ t }}</li>\n
{% endif %}\n
{% endfor %}\n
</ul>\n
{% if not hasPoint %}\n
<p class="muted">Aucun détail technique renseigné pour cet article.</p>\n
{% endif %}\n
</div>\n
\n
<div class="card">\n
<h2>Équipement de série</h2>\n
{% set printedEquip = false %}\n
{# 1) Liste explicite mainLine.features si fournie #}\n
{% if mainLine and mainLine.features is defined and mainLine.features %}\n
<ul>\n
{% for f in mainLine.features %}\n
<li>{{ f }}</li>\n
{% set printedEquip = true %}\n
{% endfor %}\n
</ul>\n
{% endif %}\n
\n
{# 2) Sinon, tentative d’extraction depuis descList avec mots-clés #}\n
{% if not printedEquip %}\n
{% set equipList = [] %}\n
{% for item in descList %}\n
{% set t = item|trim %}\n
{% if t matches '/(équipement|equipement|de série|serie)/i' %}\n
{% set equipList = equipList|merge([t]) %}\n
{% endif %}\n
{% endfor %}\n
{% if equipList %}\n
<ul>\n
{% for f in equipList %}<li>{{ f }}</li>{% endfor %}\n
</ul>\n
{% set printedEquip = true %}\n
{% endif %}\n
{% endif %}\n
\n
{% if not printedEquip %}\n
<p class="muted">Aucun équipement de série spécifié.</p>\n
{% endif %}\n
\n
{% if formationLine %}\n
<h2 style="margin-top:1rem">Formation / Mise en route</h2>\n
<p><strong>{{ formationLine.name|default('Formation / Mise en route') }}</strong> – Prix net :\n
{{ (formationLine.totalExclVat|default(formationLine.unitPriceExclVat|default(0)))|number_format(0, ',', ' ') }} € HT</p>\n
{% if formationLine.description is defined and formationLine.description %}<p class="muted">{{ formationLine.description }}</p>{% endif %}\n
{% endif %}\n
\n
{% if options %}\n
<h2 style="margin-top:1rem">Équipements recommandés</h2>\n
<ul>\n
{% for opt in options %}\n
{% set q = opt.quantity|default(1) %}\n
{% set puo = opt.unitPriceExclVat|default(0) %}\n
{% set rem = opt.discountPercent|default(0) %}\n
{% set opt_total = opt.totalExclVat|default(q * puo * (1 - (rem / 100))) %}\n
<li>{{ opt.name }} — {{ opt_total|number_format(0, ',', ' ') }} € HT</li>\n
{% endfor %}\n
</ul>\n
{% endif %}\n
</div>\n
</div>\n
\n
<!-- CONDITIONS COMMERCIALES -->\n
<div class="section">\n
<div class="card">\n
<h2>Conditions commerciales</h2>\n
<ul>\n
{% if quote.expiredAt is defined and quote.expiredAt %}<li>Validité de l’offre : 1 mois (jusqu’au {{ quote.expiredAt|date('d/m/Y') }})</li>{% else %}<li>Validité de l’offre : 1 mois</li>{% endif %}\n
{% if discount_value > 0 %}<li>Remise de service : {{ discount_percent|round(0, 'floor') }} %</li>{% endif %}\n
{% if quote.orderContext is defined and quote.orderContext %}<li>{{ quote.orderContext }}</li>{% endif %}\n
<li>Règlement {{ quote.paymentMode|default('30 jours nets par LCR') }}</li>\n
<li>Délai : {{ quote.leadTime|default('2 à 3 mois après commande') }}</li>\n
{% if quote.shippingFeesHt is defined %}\n
{% if quote.shippingFeesHt == 0 %}<li>Port franco</li>\n
{% elseif quote.shippingFeesHt > 0 %}<li>Frais de port : {{ quote.shippingFeesHt|number_format(2, ',', ' ') }} € HT</li>\n
{% else %}<li>Port : {{ quote.shippingMode|default('selon conditions') }}</li>\n
{% endif %}\n
{% else %}\n
<li>Port : {{ quote.shippingMode|default('selon conditions') }}</li>\n
{% endif %}\n
{% if quote.customerRef is defined and quote.customerRef %}<li>Réf. client : {{ quote.customerRef }}</li>{% endif %}\n
</ul>\n
</div>\n
</div>\n
\n
<!-- SIGNATURES -->\n
<div class="section grid-2">\n
<div class="card">\n
<h2>Signataires</h2>\n
<p>\n
<strong>{{ managedBy is defined and managedBy.fullname is defined ? managedBy.fullname : (quote.managedByRealName|default('')) }}</strong>\n
– {{ managedBy is defined and managedBy.role is defined and managedBy.role ? managedBy.role : 'Resp. Commercial' }}\n
{% if tel_portable %} – {{ tel_portable }}{% endif %}\n
</p>\n
<div class="signature">Signature expéditeur</div>\n
</div>\n
<div class="card">\n
<h2>Bon pour accord</h2>\n
<p><strong>{{ quote.contactIdRealName|default(c and (c.fullname is defined and c.fullname ? c.fullname : (c.name|default('')))) }}</strong>{% if comp and comp.name is defined and comp.name %} – {{ comp.name }}{% endif %}</p>\n
<div class="signature">Cachet et signature</div>\n
</div>\n
</div>\n
\n
<!-- PIED -->\n
<footer>\n
YANIGAV – Enfonce-pieux • Affûte-piquet • Fendeuse de bûche — RCS ROANNE B 403 872 724 — SIRET 403 872 724 00014 — APE 4661Z — TVA FR114038727224\n
</footer>\n
</div>\n
\n
{# PAGE 2 : CGV (optionnelle) #}\n
{% if cgv is defined or quote.cgvText is defined %}\n
<div style="page-break-before:always;"></div>\n
<div class="page">\n
<div class="section">\n
<div class="card">\n
<h2>Conditions Générales de Vente</h2>\n
<div class="note" style="white-space:pre-wrap">\n
{{ cgv|default(quote.cgvText)|raw }}\n
</div>\n
</div>\n
</div>\n
<footer>\n
Document généré automatiquement — valable sous réserve des conditions précisées ci-dessus.\n
</footer>\n
</div>\n
{% endif %}\n
</body>\n
</html>
"""
]
]
"hydra:totalItems" => 1
"hydra:view" => array:2 [
"@id" => "/api/templates?customerId=customer_121&sortField=name&sortOrder=asc"
"@type" => "hydra:PartialCollectionView"
]
"hydra:search" => array:4 [
"@type" => "hydra:IriTemplate"
"hydra:template" => "/api/templates{?id,id[],customerId,customerId[]}"
"hydra:variableRepresentation" => "BasicRepresentation"
"hydra:mapping" => array:4 [
0 => array:4 [
"@type" => "IriTemplateMapping"
"variable" => "id"
"property" => "id"
"required" => false
]
1 => array:4 [
"@type" => "IriTemplateMapping"
"variable" => "id[]"
"property" => "id"
"required" => false
]
2 => array:4 [
"@type" => "IriTemplateMapping"
"variable" => "customerId"
"property" => "customerId"
"required" => false
]
3 => array:4 [
"@type" => "IriTemplateMapping"
"variable" => "customerId[]"
"property" => "customerId"
"required" => false
]
]
]
]
|