Added select2 to slack settings

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-03-21 20:00:11 -07:00
parent 647f47cdfe
commit 637438ccf6
2 changed files with 25 additions and 3 deletions

View file

@ -5,6 +5,7 @@ namespace App\Http\Livewire;
use GuzzleHttp\Client;
use Livewire\Component;
use App\Models\Setting;
use App\Helpers\Helper;
class SlackSettingsForm extends Component
{
@ -125,7 +126,6 @@ class SlackSettingsForm extends Component
return session()->flash('error' , trans('admin/settings/message.webhook.error', ['error_message' => $e->getMessage(), 'app' => $this->webhook_name]));
}
//}
return session()->flash('error' , trans('admin/settings/message.webhook.error_misc'));
}

View file

@ -57,8 +57,8 @@
{{ trans('general.integration_option') }}
</label>
</div>
<div class="col-md-9 required">
<select wire:model="webhook_selected" aria-label="webhook_selected" class="form-control"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
<div class="col-md-9 required" wire:ignore>
<select aria-label="webhook_selected" id="select2" class="select2 form-control"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
<option value="slack">{{ trans('admin/settings/general.slack') }}</option>
<option value="general">{{ trans('admin/settings/general.general_webhook') }}</option>
</select>
@ -159,3 +159,25 @@
</div> <!-- /livewire div -->
@section('moar_scripts')
<script>
$(document).ready(function () {
$('#select2').select2();
$('#select2').on('change', function (e) {
var data = $('#select2').select2("val");
@this.set('webhook_selected', data);
});
// Re-render select2
window.livewire.hook('message.processed', function (el, component) {
$('.select2').select2();
});
});
</script>
@endsection