{{ trans('cosiri.saving') }}
@php // Convert legacy session success and validation errors into the unified // `notifications` shape for the current request only. Use session()->now // so we don't re-flash for the next request and risk persistence. $currentNotifications = session('notifications', []); if (session('success')) { $currentNotifications[] = [ 'type' => 'success', 'message' => session('success'), 'options' => ['title' => 'Success!', 'duration' => 5000], ]; } if ($errors->any()) { foreach ($errors->all() as $error) { $currentNotifications[] = [ 'type' => 'error', 'message' => $error, 'options' => ['title' => 'Validation Error', 'duration' => 8000], ]; } } if (!empty($currentNotifications)) { // Make available for the current render only session()->now('notifications', $currentNotifications); } @endphp
@csrf @if (isset($submission)) @method('POST') {{-- or use PATCH if your update route expects PATCH --}} @endif
{{-- This sets Tunisia as default --}}
@error('slogan')

{{ $message }}

@enderror

{{ trans('cosiri.sector_tip') }}

{{ trans('cosiri.year_tip') }}

{{ trans('cosiri.employees_tip') }}

{{ trans('cosiri.locations_tip') }}

{{ trans('cosiri.current_version') }}
v3.8.2
{{ trans('cosiri.click_to_change') }}

{!! trans('siri.ai_generated_company_context') ?? 'AI Generated Company Context' !!}

@php // Preserve old input or submission data; if none, default to first two options $rawScopes = old('scopes', $submission->data['scopes'] ?? null); $scopesOptions = [ 'direct_emissions' => trans('cosiri_html.direct_emissions'), 'indirect_emissions_energy' => trans('cosiri_html.indirect_emissions_energy'), 'other_indirect_emissions' => trans('cosiri_html.other_indirect_emissions'), ]; if (is_null($rawScopes) || (is_array($rawScopes) && count($rawScopes) === 0)) { // default to first two $scopesSelected = array_keys(array_slice($scopesOptions, 0, 2, true)); } else { $scopesSelected = (array) $rawScopes; } $selectedCount = count((array) $scopesSelected); @endphp

{{ trans('cosiri.select_scopes_help') }}

@foreach($scopesOptions as $val => $label) @php $isChecked = in_array($val, (array) $scopesSelected); // Consistent peer-checked classes for all scopes with appropriate colors $checkedClasses = $loop->index === 0 ? 'peer-checked:bg-red-600 peer-checked:border-transparent peer-checked:text-white peer-checked:shadow-md' : ($loop->index === 1 ? 'peer-checked:bg-amber-600 peer-checked:border-transparent peer-checked:text-white peer-checked:shadow-md' : 'peer-checked:bg-emerald-600 peer-checked:border-transparent peer-checked:text-white peer-checked:shadow-md'); @endphp
@php $isChecked = in_array($val, (array) $scopesSelected); // Base background/border colors for unselected state; force text to gray-200 when NOT selected $colorClasses = [ 'direct_emissions' => 'bg-red-500/10 border-red-200 dark:bg-red-900/20 dark:border-red-800', 'indirect_emissions_energy' => 'bg-amber-500/10 border-amber-200 dark:bg-amber-900/20 dark:border-amber-800', 'other_indirect_emissions' => 'bg-emerald-500/10 border-emerald-200 dark:bg-emerald-900/20 dark:border-emerald-800' ]; // Use consistent checked classes for all scopes $checkedColorClasses = [ 'direct_emissions' => 'bg-red-600 border-red-600 text-white', 'indirect_emissions_energy' => 'bg-amber-600 border-amber-600 text-white', 'other_indirect_emissions' => 'bg-emerald-600 border-emerald-600 text-white' ]; // Apply the consistent peer-checked classes $peerChecked = $checkedClasses; @endphp
@endforeach
{{-- Scopes (3 fixed options, rendered as selectable chips). Default: first two selected --}}
{{-- Strategy Category --}}
{{-- Strategy Category --}}

{!! trans('cosiri_html.interpretationBenchmark') !!}

{!! trans('cosiri.benchmark_chart_info') !!}

@php $dimensionOptions = [ 'strategy_and_targets', 'esg_integration', 'green_business_modelling', 'capital_allocation', 'physical_climate_risks', 'transition_climate_risks', 'compliance_risks', 'reputation_risks', 'greenhouse_gas_emissions', 'resources_water_and_energy', 'material_waste', 'pollution', 'supplier_assessment', 'sustainable_procurement_process', 'transportation_and_distribution', 'supply_chain_planning', 'product_design', 'circular_process_management', 'adoption', 'transparency_and_optimization', 'workforce_development', 'leadership_involvement', 'external_communication_and_engagement', 'governance' ]; $dimensionLabels = []; foreach ($dimensionOptions as $k) { $dimensionLabels[$k] = trans('cosiri.dimensions.' . $k . '.name'); } $submissionVersion = isset($submission) ? ($submission->data['version'] ?? 24) : 24; $dimensionKeys = $submissionVersion == 10 ? [ 'greenhouse_gas_emissions', 'resources_water_and_energy', 'material_waste', 'pollution', 'supplier_assessment', 'sustainable_procurement_process', 'transportation_and_distribution', 'supply_chain_planning', 'product_design', 'circular_process_management' ] : $dimensionOptions; @endphp
data['strengthPoints'] ?? []); $rawWeakness = old('weaknessPoints', $submission->data['weaknessPoints'] ?? []); $initialStrengths = array_map(function($p){ if (!is_array($p)) return $p; return [ 'dimension' => $p['dimension'] ?? '', 'strengthPoint_note' => js_safe($p['strengthPoint_note'] ?? $p['note'] ?? '') ]; }, (array) $rawStrengths); $initialWeaknesses = array_map(function($p){ if (!is_array($p)) return $p; return [ 'dimension' => $p['dimension'] ?? '', 'weaknessPoint_note' => js_safe($p['weaknessPoint_note'] ?? '') ]; }, (array) $rawWeakness); // JSON-encode then base64-encode to avoid HTML-escaping/entity issues $initialStrengthsJson = json_encode($initialStrengths); $initialWeaknessesJson = json_encode($initialWeaknesses); $dimensionKeysJson = json_encode($dimensionKeys); $dimensionLabelsJson = json_encode($dimensionLabels); $initialStrengthsB64 = base64_encode($initialStrengthsJson ?: '[]'); $initialWeaknessesB64 = base64_encode($initialWeaknessesJson ?: '[]'); $dimensionKeysB64 = base64_encode($dimensionKeysJson ?: '[]'); $dimensionLabelsB64 = base64_encode($dimensionLabelsJson ?: '{}'); @endphp data-initial-strength='{{ $initialStrengthsB64 ?? base64_encode('[]') }}' data-initial-weakness='{{ $initialWeaknessesB64 ?? base64_encode('[]') }}' data-dimension-keys='{{ $dimensionKeysB64 ?? base64_encode('[]') }}' data-dimension-labels='{{ $dimensionLabelsB64 ?? base64_encode('{}') }}' x-init="(function(){ try { const sB64 = $el.getAttribute('data-initial-strength') || ''; const wB64 = $el.getAttribute('data-initial-weakness') || ''; const dkB64 = $el.getAttribute('data-dimension-keys') || ''; const dlB64 = $el.getAttribute('data-dimension-labels') || ''; const s = sB64 ? JSON.parse(decodeURIComponent(escape(atob(sB64)))) : []; const w = wB64 ? JSON.parse(decodeURIComponent(escape(atob(wB64)))) : []; const dk = dkB64 ? JSON.parse(decodeURIComponent(escape(atob(dkB64)))) : []; const dl = dlB64 ? JSON.parse(decodeURIComponent(escape(atob(dlB64)))) : {}; const comp = strengthWeaknessComponent(s, w, dk, dl); // copy component properties into Alpine's $data Object.keys(comp).forEach(k => { $data[k] = comp[k]; }); if (typeof $data.init === 'function') $data.init(); } catch (e) { console.error('strengthWeaknessComponent init error', e); } })()"> {{-- Enhanced Structure: - The layout is organized into logical sections with clear visual separators. - The "Strength Points" and "Weakness Points" sections are placed side-by-side on larger screens for an intuitive SWOT analysis feel. - Repetitive icons are replaced with unique, meaningful Heroicons for each field. Enhanced Icons & Style: - Each field and section now has a descriptive icon, improving scannability. - The dynamic list items for Strengths/Weaknesses have a cleaner card design with improved spacing and layout. - Interactive elements like "Add" and "Remove" buttons have refined hover states for better user feedback. --}}

{{ trans('cosiri.strength_points') }}

{{ trans('cosiri.weakness_points') }}

@php // Emission items configuration $emission_items = [ 'InputsGoods_and_materials', 'Transport', 'InputsServices', 'EndOfLife', 'Energy', 'Freight', 'UseAndDependence', 'FixedAssets', 'OtherDirectEmissions', 'DirectWaste' ]; // Map existing emissions for lookup (stored under 'emission_items') $existing_emissions = $submission->data['emission_items'] ?? []; $existing_by_label = []; foreach ($existing_emissions as $item) { if (!empty($item['label'])) { $existing_by_label[$item['label']] = $item; } } // Uncertainty options $uncertaintyOptions = [ 'very_bad' => trans('cosiri_html.uncertainty.very_bad') ?? 'very_bad', 'bad' => trans('cosiri_html.uncertainty.bad') ?? 'bad', 'fair' => trans('cosiri_html.uncertainty.fair') ?? 'fair', 'good' => trans('cosiri_html.uncertainty.good') ?? 'good', 'very_good' => trans('cosiri_html.uncertainty.very_good') ?? 'very_good', 'excellent' => trans('cosiri_html.uncertainty.excellent') ?? 'excellent' ]; // Calculate initial sum $initialSum = 0.0; $hasOld = false; foreach ($emission_items as $ii => $lbl) { if (!is_null(old('emission_items.' . $ii . '.value'))) { $hasOld = true; break; } } if ($hasOld) { foreach ($emission_items as $ii => $lbl) { $val = old('emission_items.' . $ii . '.value'); if (is_numeric($val)) $initialSum += (float)$val; } } else { foreach ($emission_items as $lbl) { $val = $existing_by_label[$lbl]['value'] ?? null; if (is_numeric($val)) $initialSum += (float)$val; } } $prefillFootprintUncertainty = old('footprint_uncertainty', $submission->data['footprint_uncertainty'] ?? 'very_good'); @endphp
{{ trans('cosiri.total_carbon_footprint') }}
{{ number_format($initialSum, 2) }} {{ trans('cosiri.co2e_unit') }}
{{ trans('cosiri.emission_table_label') }}
{{ trans('cosiri.emission_table_value') }}
{{ trans('cosiri.emission_table_uncertainty') }}
@foreach ($emission_items as $i => $label) @php $prefilledValue = old('emission_items.' . $i . '.value', $existing_by_label[$label]['value'] ?? ''); $prefilledUncertainty = old('emission_items.' . $i . '.uncertainty', $existing_by_label[$label]['uncertainty'] ?? 'very_good'); @endphp
{{ trans('cosiri_html.EmissionFootPrint.' . $label) }}
@endforeach

@php // Emissions structure configuration $emissions_structure = [ 'DirectGES' => [ 'subCat' => [ 'DirectFixedCombustion' => null, 'DirectMobileCombustion' => null, 'DirectProcessNonEnergy' => null, 'DirectFugitive' => null, 'DirectBiomass' => null ] ], 'IndirectEnergy' => [ 'subCat' => ['IndirectElectricity' => null, 'IndirectSteamHeatCold' => null] ], 'IndirectTransport' => [ 'subCat' => [ 'TransportUpstream' => null, 'TransportDownstream' => null, 'Commute' => null, 'VisitorClientTransport' => null, 'BusinessTravel' => null ] ], 'IndirectPurchasedProducts' => [ 'subCat' => [ 'GoodsPurchase' => null, 'FixedAssetsPurchase' => null, 'WasteManagement' => null, 'UpstreamLeasedAssets' => null, 'ServicesPurchase' => null ] ], 'IndirectSoldProducts' => [ 'subCat' => [ 'ProductUse' => null, 'DownstreamLeasedAssets' => null, 'EndOfLife' => null, 'Investments' => null ] ], 'OtherIndirect' => [ 'subCat' => ['OtherIndirectEmissions' => null] ] ]; $gas_fields = [ 'co2' => 'CO₂', 'ch4' => 'CH₄', 'n2o' => 'N₂O', 'other_gases' => trans('cosiri_html.other_gases'), 'co2b' => 'CO₂b' ]; $existing_detailed_emissions = $submission->data['emissions_details'] ?? []; $categoryTotals = []; $hasOldDetailed = false; foreach ($emissions_structure as $cK => $cat) { foreach ($cat['subCat'] as $sK => $sL) { foreach ($gas_fields as $gK => $gL) { if (!is_null(old("emissions_details.{$cK}.subCat.{$sK}.{$gK}"))) { $hasOldDetailed = true; break 3; } } } } foreach ($emissions_structure as $cK => $cat) { foreach ($gas_fields as $gK => $gL) { $sum = 0; foreach ($cat['subCat'] as $sK => $sL) { $v = $hasOldDetailed ? old("emissions_details.{$cK}.subCat.{$sK}.{$gK}", '') : ($existing_detailed_emissions[$cK]['subCat'][$sK][$gK] ?? null); if (is_numeric($v)) $sum += (float)$v; } $categoryTotals[$cK][$gK] = $sum; } } // initial detailed sum now defined as sum of the first two categories excluding 'co2b' $initialDetailedSum = 0.0; $categoryKeys = array_keys($emissions_structure); $firstTwo = array_slice($categoryKeys, 0, 2); foreach ($firstTwo as $cK) { foreach ($gas_fields as $gK => $gL) { if ($gK === 'co2b') continue; // exclude CO2b $initialDetailedSum += $categoryTotals[$cK][$gK] ?? 0; } } $prefillEmissionsDetailsUncertainty = old('emissions_details_uncertainty', $submission->data['emissions_details_uncertainty'] ?? 'very_good'); @endphp
{{ trans('cosiri.detailed_emissions_total') }}
{{ number_format($initialDetailedSum, 2) }} CO₂e
@foreach ($gas_fields as $gasKey => $gasLabel) @if ($gasKey === 'co2b') @endif @endforeach @php $categoryCounter = 1; @endphp @foreach ($emissions_structure as $categoryKey => $category) @php // compute category total excluding co2b $categoryTotalNoCo2b = 0; foreach ($gas_fields as $gk => $gl) { if ($gk === 'co2b') continue; $categoryTotalNoCo2b += $categoryTotals[$categoryKey][$gk] ?? 0; } @endphp @foreach ($gas_fields as $gK => $gL) @if ($gK === 'co2b') @endif @endforeach @php $subCounter = 1; @endphp @foreach ($category['subCat'] as $subCatKey => $subCatLabel) @php // prepare values for this subcategory row and compute row total excluding co2b $rowValues = []; foreach ($gas_fields as $gk => $gl) { $rowValues[$gk] = old("emissions_details.{$categoryKey}.subCat.{$subCatKey}.{$gk}", $existing_detailed_emissions[$categoryKey]['subCat'][$subCatKey][$gk] ?? ''); } $rowTotalNoCo2b = 0; foreach ($rowValues as $rk => $rv) { if ($rk === 'co2b') continue; if (is_numeric($rv)) $rowTotalNoCo2b += (float)$rv; } @endphp @foreach ($gas_fields as $gasKey => $gasLabel) @if ($gasKey === 'co2b') @endif @php $value = $rowValues[$gasKey]; @endphp @endforeach @php $subCounter++; @endphp @endforeach @php $categoryCounter++; @endphp @endforeach
{{ trans('cosiri.category_subcategory') }}{{ trans('cosiri.total_no_co2b') }}{{ $gasLabel }}{{ trans('cosiri.emission_table_uncertainty') }}
{{ $categoryCounter }}. {{ trans('cosiri_html.GESFootPrint.' . $categoryKey) }}{{ number_format($categoryTotalNoCo2b, 2) }}{{ number_format($categoryTotals[$categoryKey][$gK] ?? 0, 2) }}
{{ $categoryCounter }}.{{ $subCounter }} {{ trans('cosiri_html.GESFootPrint.' . $subCatKey) }}{{ number_format($rowTotalNoCo2b, 2) }}

@php $initialTotalBilanCarbone = old('total_bilan_carbone', $submission->data['total_bilan_carbone'] ?? 0); $initialGesReglementaire = old('total_ges_reglementaire', $submission->data['total_ges_reglementaire'] ?? 0); if (!is_numeric($initialTotalBilanCarbone)) $initialTotalBilanCarbone = 0; if (!is_numeric($initialGesReglementaire)) $initialGesReglementaire = 0; @endphp
{{ trans('cosiri_html.carbonFootprint') ?? 'Total bilan carbone' }}
{{ trans('cosiri.co2e_unit') }}
{{ trans('cosiri_html.regulatory_ghg_balance') }}
{{ trans('cosiri.co2e_unit') }}

{{ trans('cosiri.impact_projects_summary') }}

# {{ trans('cosiri.impact_projects_summary_dimension') }}
@if (config('app.debug'))

Notification System Demo

This demo section is only visible in development mode. Click any button to test the notification system!

@endif