<div class="form-group m-form__group row">
    <label class="col-lg-3 col-form-label">
        Communication Settings:
    </label>
    <div class="col-lg-1" style="top: 9px;">
        <input type="checkbox" class="form-control m-input communication_setting" @if(!empty($comm_settings)) checked @endif value="@if(!empty($comm_settings)) 1 @else 0 @endif" name="communication_setting"/>
    </div>
    <div class="col-lg-12 comm-panel" style="display:none;">
        <label class="col-lg-4 col-form-label">
            Select Communication Options:
        </label>
        <select id="communication-multiple" name="communication[]" multiple="multiple">
            <optgroup label="Email" class="group-1">
                @foreach(\App\communicationService::$com_category as $key => $value)
                    <option value="1-{!! $key !!}" @if(!empty($comm_settings) && isset($comm_settings[0]) && in_array($key, explode(',',$comm_settings[0]['type_ids']))) selected = 'selected' @endif>{!! $value !!}</option>
                @endforeach
            </optgroup>
            <optgroup label="SMS" class="group-2">
                @foreach(\App\communicationService::$com_category as $key => $value)
                    <option value="2-{!! $key !!}" @if(!empty($comm_settings) && isset($comm_settings[1]) && in_array($key, explode(',',$comm_settings[1]['type_ids']))) selected = 'selected' @endif>{!! $value !!}</option>
                @endforeach
            </optgroup>
            <optgroup label="Whatsapp" class="group-3">
                @foreach(\App\communicationService::$com_category as $key => $value)
                    @if($value != 'Overdue')
                    <option value="3-{!! $key !!}" @if(!empty($comm_settings) && isset($comm_settings[2]) && in_array($key, explode(',',$comm_settings[2]['type_ids']))) selected = 'selected' @endif>{!! $value !!}</option>
                    @endif
                @endforeach
            </optgroup>
        </select>
    </div>
</div>
