@extends('layouts.vertical', ["page_title"=> "Add & Edit Campaigns"]) @section('css') @endsection @section('content')
@if(session()->has('message'))
{{ session()->get('message') }}
@endif
@csrf

Add / Edit {{$title}}

Back
@foreach($fields as $field => $props) @if($props['type'] != 'hidden')
@endif @switch($props['type']) @case('hidden') @break @case('text') @case('email') @case('number') @case('tel') @break @case('date') @break @case('datetime') @break @case('textarea') @break @case('select') @php $__selected = (isset($item->{$field}) && $item->{$field} !== '' && $item->{$field} !== null) ? $item->{$field} : ($props['default'] ?? null); @endphp @break @case('multiselect') @php $__selectedList = (isset($item->{$field}) && is_array($item->{$field}) && count($item->{$field})) ? $item->{$field} : ($props['default'] ?? []); @endphp @break @case('image')

500MB Max File size

@break @case('multiimage')

500MB Max File size

@break @case('file')

1GB Max File size

@break @case('ranking_attributes') @php $rankingRows = []; if ($mode === 'edit') { $rawRanking = $item->ranking_attributes ?? null; if (is_string($rawRanking) && $rawRanking !== '') { $decodedRanking = json_decode($rawRanking, true); $rawRanking = is_array($decodedRanking) ? $decodedRanking : []; } if (is_object($rawRanking)) { $rawRanking = json_decode(json_encode($rawRanking), true); } if (is_array($rawRanking)) { foreach ($rawRanking as $rankRow) { if (is_object($rankRow)) { $rankRow = (array) $rankRow; } if (!is_array($rankRow)) { continue; } $rowCode = trim((string) ($rankRow['code'] ?? '')); $rowValue = array_key_exists('value', $rankRow) ? trim((string) $rankRow['value']) : ''; if ($rowCode === '') { continue; } $rankingRows[] = [ 'code' => $rowCode, 'value' => $rowValue, ]; } } } $rankingAttrMeta = $props['attributes_meta'] ?? []; $optionAttrTypes = ['select', 'multiselect', 'checkbox', 'radio']; @endphp

Filter ranking by user attributes. Add multiple filters; each needs an attribute and value.

@if(count($rankingRows) > 0)
@endif @foreach($rankingRows as $rankRow) @php $rowCode = $rankRow['code']; $rowValue = $rankRow['value']; $rowMeta = $rankingAttrMeta[$rowCode] ?? null; $useOptions = $rowMeta && in_array(($rowMeta['type'] ?? ''), $optionAttrTypes, true) && !empty($rowMeta['options']); @endphp
@if($useOptions) @else @endif
@endforeach
@break @case('mapping')
@if($mode=='edit' && isset($item->{$field}) && is_array($item->{$field})) @foreach($item->{$field} as $map) @php $mapRules = is_object($map) ? ($map->rules ?? []) : ($map['rules'] ?? []); if (is_string($mapRules)) { $mapRules = json_decode($mapRules, true) ?: []; } elseif (!is_array($mapRules)) { $mapRules = json_decode(json_encode($mapRules), true) ?: []; } $mapRulesCount = is_array($mapRules) ? count($mapRules) : 0; @endphp @endforeach @endif
Metric Display Sort Weight Label Text Unit Type Rules
@break @case('combined_metrics')
@php $combinedMetricsRows = []; if ($mode == 'edit' && isset($item->{$field}) && $item->{$field} !== '' && $item->{$field} !== '[]') { $decoded = json_decode($item->{$field}, true); $combinedMetricsRows = is_array($decoded) ? $decoded : []; } @endphp @if(!empty($combinedMetricsRows)) @foreach($combinedMetricsRows as $i => $map) @php if (is_object($map)) { $map = json_decode(json_encode($map), true); } if (!is_array($map)) { $map = []; } $combinedRules = $map['rules'] ?? []; if (is_string($combinedRules)) { $combinedRules = json_decode($combinedRules, true) ?: []; } elseif (!is_array($combinedRules)) { $combinedRules = json_decode(json_encode($combinedRules), true) ?: []; } $combinedRulesCount = is_array($combinedRules) ? count($combinedRules) : 0; $combinedRulesInterval = $map['rules_interval'] ?? 'overall'; $combinedRulesCustomStart = $map['rules_custom_start'] ?? ''; $combinedRulesCustomEnd = $map['rules_custom_end'] ?? ''; if (empty($map['rules_interval']) && !empty($combinedRules[0]['interval'])) { $combinedRulesInterval = $combinedRules[0]['interval']; $combinedRulesCustomStart = $combinedRules[0]['custom_start'] ?? ''; $combinedRulesCustomEnd = $combinedRules[0]['custom_end'] ?? ''; } @endphp @endforeach @endif
Type Title Include Metrics Weight Label Text Unit Type Rules
@break @endswitch @if($props['type'] != 'hidden')
@endif @endforeach
Back
@endsection @section('script') @endsection