@extends('layout.backend') @section('scripts') @parent @vite(['resources/js/settings.js']) @endsection @section('content') @if(session()->has('alert-success'))
{!! session()->get('alert-success') !!}
@endif @if(session()->has('alert-warning'))
{!! session()->get('alert-warning') !!}
@endif @if(session()->has('alert-error'))
{!! session()->get('alert-error') !!}
@endif
Configurações Globais
@if($errors->any())
ATENÇÃO:
    @foreach ($errors->all() as $error)
  • {!! $error !!}
  • @endforeach
@endif @php $whatsappConnected = $whatsappStatus === 'open'; $wuzapiConnected = $wuzapiStatus === 'open'; $apiConnected = $whatsappConnected || $wuzapiConnected; $whatsappDisabled = !$whatsappConnected; $isWhatsappRelated = function($setting) { return $setting->type === 'whatsapp_group' || (str_contains($setting->key, 'whatsapp') && $setting->key !== 'whatsapp-api'); }; $whatsappApi = \App\Helpers\AppHelper::getAppSetting('whatsapp-api') ?: 'evolution'; @endphp {!! Form::open(['id' => 'form-edit-settings', 'url' => route('settings.store'), 'autocomplete' => 'off']) !!}
@foreach ($settingsGroup as $group) @if ($group->settings->count() > 0)
@php $sortedSettings = $group->settings->sort(function($a, $b) { $cat = function($s) { if (str_contains($s->key, 'whatsapp') || $s->type === 'whatsapp_group') return 2; if (str_contains($s->key, 'email')) return 1; return 0; }; return $cat($a) <=> $cat($b) ?: $a->position <=> $b->position; }); @endphp @foreach($sortedSettings as $setting) @php if ($setting->key === 'whatsapp-api') { $disabled = $apiConnected; } else { $disabled = $whatsappDisabled && $isWhatsappRelated($setting); } $da = $disabled ? ['disabled' => 'disabled'] : []; @endphp
@if ($setting->type=='string') {!! Form::text($setting->key, $setting->value, ['class' => "form-control"] + $da) !!} @endif @if ($setting->type=='int') {!! Form::number($setting->key, $setting->value, ['class' => "form-control"] + $da) !!} @endif @if ($setting->type=='userlookup') {!! Form::select($setting->key, $users, $setting->value, ['class' => "form-control"] + $da) !!} @endif @if ($setting->type=='json') {!! Form::select($setting->key, $setting->options(), $setting->set(), ['class' => "form-control"] + $da) !!} @endif @if ($setting->type=='model') {!! Form::select($setting->key, $setting->options(), $setting->set(), ['class' => "form-control"] + $da) !!} @endif @if ($setting->type=='whatsapp_group') @if($whatsappStatus == 'open')
{!! Form::select($setting->key, [], $setting->value, ['class' => "form-control whatsapp-group-select", 'data-key' => $setting->key, 'data-selected' => $setting->value]) !!}
@else
Conecte o WhatsApp primeiro
{!! Form::hidden($setting->key, $setting->value) !!} @endif @endif
@if ($setting->details)
{!! $setting->details !!}
@endif
@endforeach
@endif @endforeach {{-- Aba WhatsApp --}}
{{-- Status da conexão --}}
O dispositivo conectado será utilizado para o envio de mensagens aos membros.
@if($whatsappApi === 'evolution')
Evolution API
@if($whatsappStatus == 'open') @php $testPhone = auth()->user()->phone_primary ?? '—'; $testMsg = 'WhatsApp ' . config('app.name') . ' conectado'; @endphp
WhatsApp conectado.
Testar envio Desconectar @else
WhatsApp não está conectado.
Conectar @endif
@endif @if($whatsappApi === 'wuzapi')
WUZAPI
@if($wuzapiStatus == 'open') @php $testPhone = auth()->user()->phone_primary ?? '—'; $testMsg = 'WhatsApp ' . config('app.name') . ' conectado (WUZAPI)'; @endphp
WhatsApp (WUZAPI) conectado.
Testar envio Desconectar @else
WhatsApp (WUZAPI) não está conectado.
Conectar @endif
@endif
{!! Form::submit('SALVAR', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}
@endsection