@php if (!function_exists('brief_value')) { function brief_to_text($value, $sep = ', ') { if (is_null($value)) return '--'; if (is_string($value)) { $trim = trim($value); if ($trim === '') return '--'; $decoded = json_decode($value, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $value = $decoded; } else { return $value; } } if (is_array($value)) { $flat = array(); foreach ($value as $v) { if (is_scalar($v)) { $flat[] = (string)$v; } elseif (is_array($v)) { $inner = array(); foreach ($v as $vv) { $inner[] = is_scalar($vv) ? (string)$vv : (is_object($vv) ? json_encode($vv, JSON_UNESCAPED_UNICODE) : ''); } $flat[] = implode($sep, array_filter($inner, function($s){ return $s !== ''; })); } elseif (is_object($v)) { if (method_exists($v, '__toString')) { $flat[] = (string)$v; } else { $flat[] = json_encode($v, JSON_UNESCAPED_UNICODE); } } else { $flat[] = ''; } } $out = implode($sep, array_filter($flat, function($s){ return $s !== ''; })); return $out !== '' ? $out : '--'; } if (is_object($value)) { if (method_exists($value, '__toString')) return (string)$value; return json_encode($value, JSON_UNESCAPED_UNICODE); } return (string)$value; } function brief_value($value, $default = '--') { $txt = brief_to_text($value); return $txt === '--' ? $default : brief_clean($txt); } function brief_clean($text) { if (is_string($text)) { $decoded = json_decode('"' . addslashes($text) . '"'); if ($decoded !== null) return $decoded; } return $text; } } @endphp {{-- si possible download PDF --}}
@php $brief = (new App\Http\Controllers\BriefController())->brief( $projet->id, 1 ) ; @endphp {{-- {{ ($brief['level']) }} --}}
@foreach ($brief['projets'] as $p)
{{ $p['question'] }} @if ($p['type'] == 'textarea' || $p['type'] == 'text')

{{ brief_value($projet->brief[$p['name']] ?? null) }}

@endif @if ($p['type'] == 'radio') @if ($p['reponses'] ?? 0) @foreach ($p['reponses'] as $reponse)
{{ $reponse['libelle'] }}
@if ($reponse['libelle'] == 'Autre' /*&& $projet->brief[ $reponse['name'] ] == $reponse['value'] */) {{ brief_value($projet->brief[str_replace('[]', '', $reponse['name']) . '_preciser'] ?? null) }} @endif @if ($reponse['name'] == 'projet_q4' && $reponse['value'] == 'Oui') {{ brief_value($projet->brief[str_replace('[]', '', $reponse['name']) . '_preciser'] ?? null) }} @endif @endforeach @endif @endif {{-- TODO : à verifier --}} @if ($p['type'] == 'checkbox') @if ($p['reponses'][0]['name'] == 'projet_q1[]') @if ($p['reponses'] ?? 0) @foreach ($p['reponses'] as $reponse) @if (is_array(json_decode($projet->brief[str_replace('[]', '', $reponse['name'])])))
{{ $reponse['libelle'] }}
@else
{{ $reponse['libelle'] }}
@endif @if ( $reponse['libelle'] == 'Autre' && in_array( $reponse['value'], is_array(json_decode($projet->brief[str_replace('[]', '', $reponse['name'])])) ? json_decode($projet->brief[str_replace('[]', '', $reponse['name'])]) : [])) {{ brief_value($projet->brief[str_replace('[]', '', $reponse['name']) . '_preciser'] ?? null) }} @endif @endforeach @endif @else @if ($p['reponses'] ?? 0) @foreach ($p['reponses'] as $reponse) @if (is_array($projet->brief[str_replace('[]', '', $reponse['name'])]))
{{ $reponse['libelle'] }}
@else
{{ $reponse['libelle'] }}
@endif @if ( $reponse['libelle'] == 'Autre' && isset($projet->brief[str_replace('[]', '', $reponse['name'])]) && is_array($projet->brief[str_replace('[]', '', $reponse['name'])]) && in_array($reponse['value'], $projet->brief[str_replace('[]', '', $reponse['name'])])) {{ brief_value($projet->brief[str_replace('[]', '', $reponse['name']) . '_preciser'] ?? null) }} @endif @endforeach @endif @endif @endif

@endforeach
{{-- {{ count($brief['personalite']) }} --}} @foreach ($brief['personalite'] as $p)
{{ $p['question'] }} @if ($p['type'] == 'textarea' || $p['type'] == 'text')

{{ brief_value($projet->brief[$p['name']] ?? null) }}

@endif @if ($p['type'] == 'radio') @if ($p['reponses'] ?? 0) @foreach ($p['reponses'] as $reponse)
{{ $reponse['libelle'] }}
@endforeach @endif @endif {{-- TODO : à verifier --}} @if ($p['type'] == 'checkbox') @if ($p['reponses'] ?? 0) @foreach ($p['reponses'] as $reponse) @if (is_array($projet->brief[str_replace('[]', '', $reponse['name'])]) && $projet->brief[str_replace('[]', '', $reponse['name'])] ?? 0)
{{ $reponse['libelle'] }}
@else
{{ $reponse['libelle'] }}
@endif @endforeach @endif @endif

@endforeach @if ($projet->type == 'pro') {{ lang('Si oui, téléchargez votre charte graphique.') }} @if ($projet->brief) @if (!$projet->brief->charte) Aucune photo téléchargée @else
@php $j = 0; @endphp @foreach (json_decode($projet->brief->charte) ?? [] as $photo) @php $extension = pathinfo(asset($photo))['extension']; @endphp
@if ($extension == 'pdf')
@else
@endif

{{ json_decode($projet->brief->commentaire_charte)[$j++] ?? '' }}

@endforeach
@endif @endif @endif
@foreach ($brief['palettes'] as $p) @php $index = (int) preg_replace('/[^0-9]/', '', $p['name']); @endphp
@if ($p['palette'] ?? 0) {{ $p['question'] }} (x/5) @php $i=0; @endphp
@foreach ($p['palette'] as $key => $url) @if ($index > 36)

{{ $key }} : {{ json_decode($projet->brief[$p['name']])[$i] ?? '-' }}
@else

{{ $key }} : {{ $projet->brief[$p['name']][$i] ?? '-' }}
@endif @php $i++; @endphp @endforeach
@endif @if ($p['type'] == 'textarea' || $p['type'] == 'text') {{ $p['question'] }}

{{ brief_value($projet->brief[$p['name']] ?? null) }}

@endif

@endforeach
{{-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --}}
{!! lang('Une photo, un visuel ou une mise en situation ont attiré votre attention ?') !!} {!! lang('Copiez-collez les liens qui vous ont séduit sur Pinterest ou toute autres source.') !!} @if ($projet->brief) @if (!$projet->brief->inspiration_attire_attention) Aucun lien ajouté @else @foreach ($projet->brief->inspiration_attire_attention as $link) @if (trim($link)) @if (strpos($link, 'http') !== false) {{ $link }} @else {{ $link }} @endif @endif @endforeach @endif @endif {!! lang("Vous avez aussi la possibilité de télécharger vos photos d'inspiration préférées.") !!} @if ($projet->brief) @if (!$projet->brief->inspirations) Aucune photo téléchargée @else
@php $j = 0; @endphp @foreach ($projet->brief->inspirations ?? [] as $photo)
@if ($projet->brief->commentaire_inspirations[$j] ?? null)

{{ $projet->brief->commentaire_inspirations[$j] ?? '' }}

@endif
@php $j++; @endphp @endforeach
@endif @endif {!! lang("Qu'est-ce que vous rêvez d'avoir dans votre nouvel espace ?") !!}

{{ brief_value($projet->brief->reve ?? null) }}

{!! lang("A l'inverse, qu'est-ce que vous voulez absolument éviter dans votre nouvel espace ?") !!}

{{ brief_value($projet->brief->eviter ?? null) }}

{{-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --}}
@foreach ($brief['budgets'] as $p)
{{ $question }} @if ($p['type'] ?? 0) @if ($p['type'] == 'radio') @if ($p['reponses'] ?? 0) {!! lang('Pas flexible') !!} @foreach ($p['reponses'] as $reponse)
{{ $reponse['libelle'] }}
@endforeach {!! lang('Très flexible') !!} @endif @endif @if ($p['type'] == 'textarea' || $p['type'] == 'text')

{{ brief_value($projet->brief[$p['name']] ?? null) }}

@endif @endif @if ($p['elements'] ?? 0) @foreach ($p['elements'] as $key => $element)
{{ $element['libelle'] }}
@endforeach @endif

@endforeach
{{-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --}}
{!! lang('Prenez et téléchargez le plus de photos possible de votre espace.') !!}
{!! lang( 'Nous souhaitons avoir 4 photos au minimum : une photo de chaque côté, et une photo du plafond si applicable.', ) !!} {!! lang('(Champ obligatoire)') !!}
@if ($projet->brief) @if (!$projet->brief->espaces) Aucune photo téléchargée @else
@php $j = 0; @endphp @foreach ($projet->brief->espaces ?? [] as $photo)

{{ $projet->brief->commentaire_espaces[$j++] ?? '' }}

@endforeach
@endif @endif {{ lang('Téléchargez un plan ou un croquis avec les dimensions de votre espace.') }} @if ($projet->brief) @if (!$projet->brief->plans) Aucune photo téléchargée @else
@php $j = 0; @endphp @foreach ($projet->brief->plans ?? [] as $photo) @php $extension = pathinfo(asset($photo))['extension']; @endphp
@if ($extension == 'pdf')
@else
@endif

{{ $projet->brief->commentaire_plans[$j++] ?? '' }}

@endforeach
@endif @endif {!! lang('Prenez et téléchargez une petite vidéo de votre espace.') !!} @if ($projet->brief->videos ?? 0) @if (is_array($projet->brief->videos)) @foreach ($projet->brief->videos as $video)
@endforeach @else
@endif @else Aucune vidéo ajoutée @endif {!! lang( 'Souhaitez-vous conserver certains de vos meubles ou objets actuels dans votre nouvel espace ? Si oui, lesquels ?', ) !!} @if ($projet->brief->conserver_meuble_text ?? '')

{{ brief_value($projet->brief->conserver_meuble_text ?? null) }}

@endif {!! lang( 'Téléchargez des photos, en gros plan si possible, des meubles et des objets décoratifs que vous souhaitez conserver.', ) !!} @if ($projet->brief) @if (!$projet->brief->meubles) Aucune photo téléchargée @else
@php $j = 0; @endphp @foreach ($projet->brief->meubles ?? [] as $photo)

{{ $projet->brief->commentaire_meubles[$j++] ?? '' }}

@endforeach
@endif @endif {!! lang( 'Copiez-collez, si possible, des liens internet renvoyant vers ces meubles et ces objets décoratifs à conserver.', ) !!} @if ($projet->brief) @if (!$projet->brief->attire_attention) Aucun lien ajouté @else @foreach ($projet->brief->attire_attention as $link) @if (trim($link)) @if (strpos($link, 'http') !== false) {{ $link }} @else {{ $link }} @endif @endif @endforeach @endif @endif {!! lang( 'Avez-vous un commentaire ou une précision à apporter concernant votre espace (contraintes techniques, installation électriques, faux plafonds …) ?', ) !!}

{{ brief_value($projet->brief->commentaire ?? null) }}

{{-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --}}