@extends(config('ogformbuilder.layout')) @section('title', $isFormBuilder ?? false ? 'Form Builder' : 'Quotation Form') @push('styles') @endpush @section('content')
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
@endif
@csrf @if($isNew == false) @endif @if(!empty($isNew) && $isNew === false) @else
@error('title') {{ $message }} @enderror
@endif @php $authUser = \Illuminate\Support\Facades\Auth::user(); $isSuperAdmin = $authUser->isSuperAdmin() ?? false; $isFormBuilderPage = $isFormBuilder ?? false; // Only show company assignment for super admin in form builder $showCompanyAssignment = $isSuperAdmin && $isFormBuilderPage; $allCompanies = []; if ($showCompanyAssignment) { $allCompanies = \App\Models\Company::with('users') ->orderBy('name') ->get() ->mapWithKeys(function ($company) { return [$company->id => $company->name]; }) ->toArray(); } // Get selected company IDs safely $selectedCompanyIds = []; if (isset($form->companies) && is_object($form->companies) && method_exists($form->companies, 'pluck')) { $selectedCompanyIds = $form->companies->pluck('id')->toArray() ?? []; } @endphp @if($showCompanyAssignment && count($allCompanies) > 0)
Hold Ctrl/Cmd to select multiple companies @error('company_ids') {{ $message }} @enderror
@endif
status ?? 'inactive') === 'active' ? 'checked' : '' }}>
status ?? 'inactive') === 'inactive' ? 'checked' : '' }}>
@endsection @push('scripts') @endpush