2023-03-14 09:38:30 -07:00
|
|
|
{{-- Page title --}}
|
|
|
|
@section('title')
|
|
|
|
{{ trans('admin/settings/general.webhook_title') }}
|
|
|
|
@parent
|
|
|
|
@stop
|
2023-03-07 15:48:21 -08:00
|
|
|
|
2023-03-14 09:38:30 -07:00
|
|
|
@section('header_right')
|
|
|
|
<a href="{{ route('settings.index') }}" class="btn btn-primary"> {{ trans('general.back') }}</a>
|
|
|
|
@stop
|
2023-03-07 15:48:21 -08:00
|
|
|
|
|
|
|
|
2023-03-14 09:38:30 -07:00
|
|
|
{{-- Page content --}}
|
|
|
|
@section('content')
|
2023-03-07 15:48:21 -08:00
|
|
|
|
2023-03-21 18:58:26 -07:00
|
|
|
<div><!-- livewire div - do not remove -->
|
2024-05-29 12:11:33 -07:00
|
|
|
<form class="form-horizontal" role="form" wire:submit="submit">
|
2023-03-21 16:12:46 -07:00
|
|
|
{{csrf_field()}}
|
2024-10-28 13:57:42 -07:00
|
|
|
@if (session()->has('warning'))
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
{!! session('warning') !!}
|
|
|
|
@php
|
|
|
|
session()->forget('warning'); // Clear the session flash immediately
|
|
|
|
@endphp
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-03-07 15:48:21 -08:00
|
|
|
<div class="row">
|
2023-03-21 18:58:26 -07:00
|
|
|
|
2023-03-07 15:48:21 -08:00
|
|
|
<div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
|
2023-03-21 18:58:26 -07:00
|
|
|
|
|
|
|
<div class="panel box box-default">
|
|
|
|
|
|
|
|
<div class="box-header with-border">
|
|
|
|
<h2 class="box-title">
|
|
|
|
<i class="{{$webhook_icon}}"></i> {{ trans('admin/settings/general.webhook', ['app' => $webhook_name] ) }}
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box-body">
|
|
|
|
@if($webhook_selected != 'general')
|
|
|
|
<div class="col-md-12">
|
|
|
|
<p>
|
|
|
|
{!! trans('admin/settings/general.webhook_integration_help',array('webhook_link' => $webhook_link, 'app' => $webhook_name)) !!}
|
|
|
|
</p>
|
|
|
|
<br>
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-03-01 12:30:32 -08:00
|
|
|
|
2023-03-21 15:53:09 -07:00
|
|
|
<div class="col-md-12" style="border-top: 0px;">
|
2023-03-01 12:30:32 -08:00
|
|
|
|
|
|
|
@if(session()->has('success'))
|
|
|
|
<div class="alert alert-success fade in">
|
|
|
|
{{session('success')}}
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
@if(session()->has('error'))
|
|
|
|
<div class="alert alert-danger fade in">
|
|
|
|
{{session('error')}}
|
|
|
|
</div>
|
|
|
|
@endif
|
2023-03-01 17:10:10 -08:00
|
|
|
|
2023-03-21 18:58:26 -07:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-2">
|
2023-03-14 09:38:30 -07:00
|
|
|
<label for="webhook_selected">
|
|
|
|
{{ trans('general.integration_option') }}
|
2023-03-21 20:56:08 -07:00
|
|
|
|
|
|
|
</label>
|
2023-03-01 12:30:32 -08:00
|
|
|
</div>
|
2023-03-21 20:00:11 -07:00
|
|
|
<div class="col-md-9 required" wire:ignore>
|
2023-03-21 20:56:08 -07:00
|
|
|
|
2023-03-21 22:18:42 -07:00
|
|
|
@if (Helper::isDemoMode())
|
2024-01-29 12:58:09 -08:00
|
|
|
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:100%', 'disabled')) }}
|
2023-03-21 22:18:42 -07:00
|
|
|
@else
|
2024-01-29 12:58:09 -08:00
|
|
|
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'data-minimum-results-for-search' => '-1', 'style'=>'width:100%')) }}
|
2023-03-21 22:18:42 -07:00
|
|
|
@endif
|
2023-03-21 20:56:08 -07:00
|
|
|
|
2023-03-01 12:30:32 -08:00
|
|
|
</div>
|
2023-03-21 18:58:26 -07:00
|
|
|
</div>
|
|
|
|
|
2023-03-21 19:22:18 -07:00
|
|
|
@if (Helper::isDemoMode())
|
2023-03-21 18:58:26 -07:00
|
|
|
@include('partials.forms.demo-mode')
|
|
|
|
@endif
|
2023-03-01 12:30:32 -08:00
|
|
|
|
2023-03-21 18:58:26 -07:00
|
|
|
<!--Webhook endpoint-->
|
|
|
|
<div class="form-group{{ $errors->has('webhook_endpoint') ? ' error' : '' }}">
|
|
|
|
<div class="col-md-2">
|
|
|
|
{{ Form::label('webhook_endpoint', trans('admin/settings/general.webhook_endpoint',['app' => $webhook_name ])) }}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-9 required">
|
2024-05-29 12:11:02 -07:00
|
|
|
<input type="text" wire:model.blur="webhook_endpoint" class="form-control" placeholder="{{$webhook_placeholder}}" value="{{old('webhook_endpoint', $webhook_endpoint)}}"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
2023-03-21 18:58:26 -07:00
|
|
|
{!! $errors->first('webhook_endpoint', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
|
|
</div>
|
2023-03-01 12:30:32 -08:00
|
|
|
</div>
|
|
|
|
|
2023-03-21 19:22:18 -07:00
|
|
|
@if (Helper::isDemoMode())
|
2023-03-21 18:58:26 -07:00
|
|
|
@include('partials.forms.demo-mode')
|
|
|
|
@endif
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Webhook channel -->
|
2024-01-29 12:58:09 -08:00
|
|
|
@if($webhook_selected != 'microsoft' && $webhook_selected!= 'google')
|
|
|
|
<div class="form-group{{ $errors->has('webhook_channel') ? ' error' : '' }}">
|
|
|
|
<div class="col-md-2">
|
|
|
|
{{ Form::label('webhook_channel', trans('admin/settings/general.webhook_channel',['app' => $webhook_name ])) }}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-9 required">
|
2024-05-29 12:11:02 -07:00
|
|
|
<input type="text" wire:model.blur="webhook_channel" class="form-control" placeholder="#IT-Ops" value="{{ old('webhook_channel', $webhook_channel) }}"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
2023-03-01 12:30:32 -08:00
|
|
|
|
2024-01-29 12:58:09 -08:00
|
|
|
{!! $errors->first('webhook_channel', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
|
|
</div>
|
2023-03-14 09:38:30 -07:00
|
|
|
</div>
|
2024-01-29 12:58:09 -08:00
|
|
|
@endif
|
2023-03-14 09:38:30 -07:00
|
|
|
|
2023-03-21 19:22:18 -07:00
|
|
|
@if (Helper::isDemoMode())
|
2023-03-21 18:58:26 -07:00
|
|
|
@include('partials.forms.demo-mode')
|
|
|
|
@endif
|
|
|
|
|
|
|
|
<!-- Webhook botname -->
|
2024-01-29 12:58:09 -08:00
|
|
|
@if($webhook_selected != 'microsoft' && $webhook_selected != 'google')
|
2024-01-17 16:30:27 -08:00
|
|
|
<div class="form-group{{ $errors->has('webhook_botname') ? ' error' : '' }}">
|
|
|
|
<div class="col-md-2">
|
|
|
|
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-9">
|
2024-05-29 12:11:02 -07:00
|
|
|
<input type="text" wire:model.blur="webhook_botname" class='form-control' placeholder="Snipe-Bot" {{ old('webhook_botname', $webhook_botname)}}{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
2024-01-17 16:30:27 -08:00
|
|
|
{!! $errors->first('webhook_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
|
|
</div><!--col-md-10-->
|
2023-03-01 12:30:32 -08:00
|
|
|
</div>
|
2024-01-17 16:30:27 -08:00
|
|
|
@endif
|
2023-03-21 19:22:18 -07:00
|
|
|
@if (!Helper::isDemoMode())
|
2023-03-21 18:58:26 -07:00
|
|
|
@include('partials.forms.demo-mode')
|
|
|
|
@endif
|
2023-03-01 12:30:32 -08:00
|
|
|
|
2023-03-21 18:58:26 -07:00
|
|
|
<!--Webhook Integration Test-->
|
2024-01-29 12:58:09 -08:00
|
|
|
|
2023-03-21 18:58:26 -07:00
|
|
|
@if($webhook_endpoint != null && $webhook_channel != null)
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-offset-2 col-md-9">
|
2024-01-29 12:58:09 -08:00
|
|
|
<a href="#" wire:click.prevent="{{$webhook_test}}"
|
2023-03-21 18:58:26 -07:00
|
|
|
class="btn btn-default btn-sm pull-left">
|
|
|
|
<i class="{{$webhook_icon}}" aria-hidden="true"></i>
|
|
|
|
{!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!}
|
|
|
|
</a>
|
|
|
|
<div wire:loading>
|
|
|
|
<span style="padding-left: 5px; font-size: 20px">
|
|
|
|
<i class="fas fa-spinner fa-spin" aria-hidden="true"></i>
|
|
|
|
</span>
|
2023-03-07 15:48:21 -08:00
|
|
|
</div>
|
2023-03-01 12:30:32 -08:00
|
|
|
</div>
|
2023-03-21 18:58:26 -07:00
|
|
|
</div>
|
2023-03-01 12:30:32 -08:00
|
|
|
@endif
|
2023-03-21 18:58:26 -07:00
|
|
|
</div><!-- /.col-md-12 -->
|
|
|
|
</div><!-- /.box-body -->
|
|
|
|
|
|
|
|
<div class="box-footer">
|
|
|
|
<div class="text-right col-md-12">
|
2023-03-21 19:22:18 -07:00
|
|
|
|
2023-03-21 19:27:05 -07:00
|
|
|
<button type="reset" wire:click.prevent="clearSettings" class="col-md-2 text-left btn btn-danger pull-left"{{ Helper::isDemoMode() ? ' disabled' : ''}}>{{ trans('general.clear_and_save') }}</button>
|
2023-03-21 18:58:26 -07:00
|
|
|
|
|
|
|
<a class="btn btn-link pull-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
|
|
|
|
|
|
|
|
2023-03-21 19:22:18 -07:00
|
|
|
<button type="submit" {{$isDisabled}} class="btn btn-primary"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
2024-08-18 09:26:44 -07:00
|
|
|
<x-icon type="checkmark" /> {{ $save_button }}</button>
|
2023-03-21 18:58:26 -07:00
|
|
|
|
|
|
|
</div> <!-- /.col-md-12 -->
|
|
|
|
</div><!--box-footer-->
|
|
|
|
|
|
|
|
</div> <!-- /.box -->
|
|
|
|
</div> <!-- /.col-md-8-->
|
|
|
|
</div> <!-- /.row -->
|
|
|
|
</form>
|
|
|
|
</div> <!-- /livewire div -->
|
2023-03-01 12:30:32 -08:00
|
|
|
|
2023-03-21 15:53:09 -07:00
|
|
|
|
2023-03-21 20:00:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
@section('moar_scripts')
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
$('#select2').select2();
|
|
|
|
$('#select2').on('change', function (e) {
|
|
|
|
var data = $('#select2').select2("val");
|
2023-03-21 21:00:43 -07:00
|
|
|
@this.set('webhook_selected', data);
|
2023-03-21 20:00:11 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|