mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge pull request #12705 from snipe/fixes/webhook_ui
Slack webhook UI tweaks, added select2
This commit is contained in:
commit
e55fc4d047
|
@ -1147,4 +1147,39 @@ class Helper
|
||||||
return $age;
|
return $age;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a shorter way to see if the app is in demo mode.
|
||||||
|
*
|
||||||
|
* This makes it cleanly available in blades and in controllers, e.g.
|
||||||
|
*
|
||||||
|
* Blade:
|
||||||
|
* {{ Helper::isDemoMode() ? ' disabled' : ''}} for form blades where we need to disable a form
|
||||||
|
*
|
||||||
|
* Controller:
|
||||||
|
* if (Helper::isDemoMode()) {
|
||||||
|
* // don't allow the thing
|
||||||
|
* }
|
||||||
|
* @todo - use this everywhere else in the app where we have very long if/else config('app.lock_passwords') stuff
|
||||||
|
*/
|
||||||
|
public function isDemoMode() {
|
||||||
|
if (config('app.lock_passwords') === true) {
|
||||||
|
return true;
|
||||||
|
\Log::debug('app locked!');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I know it's gauche to return a shitty HTML string, but this is just a helper and since it will be the same every single time,
|
||||||
|
* it seemed pretty safe to do here. Don't you judge me.
|
||||||
|
*/
|
||||||
|
public function showDemoModeFieldWarning() {
|
||||||
|
if (Helper::isDemoMode()) {
|
||||||
|
return "<p class=\"text-warning\"><i class=\"fas fa-lock\"></i>" . trans('general.feature_disabled') . "</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Http\Livewire;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
class SlackSettingsForm extends Component
|
class SlackSettingsForm extends Component
|
||||||
{
|
{
|
||||||
|
@ -27,7 +28,7 @@ class SlackSettingsForm extends Component
|
||||||
'webhook_botname' => 'string|nullable',
|
'webhook_botname' => 'string|nullable',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function mount(){
|
public function mount() {
|
||||||
$this->webhook_text= [
|
$this->webhook_text= [
|
||||||
"slack" => array(
|
"slack" => array(
|
||||||
"name" => trans('admin/settings/general.slack') ,
|
"name" => trans('admin/settings/general.slack') ,
|
||||||
|
@ -62,12 +63,14 @@ class SlackSettingsForm extends Component
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public function updated($field){
|
public function updated($field) {
|
||||||
|
|
||||||
if($this->webhook_selected != 'general') {
|
if($this->webhook_selected != 'general') {
|
||||||
$this->validateOnly($field, $this->rules);
|
$this->validateOnly($field, $this->rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function updatedWebhookSelected(){
|
|
||||||
|
public function updatedWebhookSelected() {
|
||||||
$this->webhook_name = $this->webhook_text[$this->webhook_selected]['name'];
|
$this->webhook_name = $this->webhook_text[$this->webhook_selected]['name'];
|
||||||
$this->webhook_icon = $this->webhook_text[$this->webhook_selected]["icon"]; ;
|
$this->webhook_icon = $this->webhook_text[$this->webhook_selected]["icon"]; ;
|
||||||
$this->webhook_placeholder = $this->webhook_text[$this->webhook_selected]["placeholder"];
|
$this->webhook_placeholder = $this->webhook_text[$this->webhook_selected]["placeholder"];
|
||||||
|
@ -78,7 +81,7 @@ class SlackSettingsForm extends Component
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isButtonDisabled(){
|
private function isButtonDisabled() {
|
||||||
if($this->webhook_selected == 'slack') {
|
if($this->webhook_selected == 'slack') {
|
||||||
if (empty($this->webhook_endpoint)) {
|
if (empty($this->webhook_endpoint)) {
|
||||||
$this->isDisabled = 'disabled';
|
$this->isDisabled = 'disabled';
|
||||||
|
@ -91,6 +94,7 @@ class SlackSettingsForm extends Component
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$this->isButtonDisabled();
|
$this->isButtonDisabled();
|
||||||
|
@ -115,48 +119,59 @@ class SlackSettingsForm extends Component
|
||||||
]);
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$webhook->post($this->webhook_endpoint, ['body' => $payload]);
|
$webhook->post($this->webhook_endpoint, ['body' => $payload]);
|
||||||
$this->isDisabled='';
|
$this->isDisabled='';
|
||||||
$this->save_button = trans('general.save');
|
$this->save_button = trans('general.save');
|
||||||
return session()->flash('success' , 'Your '.$this->webhook_name.' Integration works!');
|
return session()->flash('success' , 'Your '.$this->webhook_name.' Integration works!');
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
$this->isDisabled= 'disabled';
|
$this->isDisabled= 'disabled';
|
||||||
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', ['error_message' => $e->getMessage(), 'app' => $this->webhook_name]));
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
return session()->flash('error' , trans('admin/settings/message.webhook.error_misc'));
|
||||||
return session()->flash('message' , trans('admin/settings/message.webhook.error_misc'));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearSettings(){
|
public function clearSettings(){
|
||||||
$this->webhook_endpoint = '';
|
|
||||||
$this->webhook_channel = '';
|
|
||||||
$this->webhook_botname = '';
|
|
||||||
$this->setting->webhook_endpoint = '';
|
|
||||||
$this->setting->webhook_channel = '';
|
|
||||||
$this->setting->webhook_botname = '';
|
|
||||||
|
|
||||||
$this->setting->save();
|
if (Helper::isDemoMode()) {
|
||||||
|
session()->flash('error',trans('general.feature_disabled'));
|
||||||
|
} else {
|
||||||
|
$this->webhook_endpoint = '';
|
||||||
|
$this->webhook_channel = '';
|
||||||
|
$this->webhook_botname = '';
|
||||||
|
$this->setting->webhook_endpoint = '';
|
||||||
|
$this->setting->webhook_channel = '';
|
||||||
|
$this->setting->webhook_botname = '';
|
||||||
|
|
||||||
session()->flash('save',trans('admin/settings/message.update.success'));
|
$this->setting->save();
|
||||||
|
|
||||||
|
session()->flash('success', trans('admin/settings/message.update.success'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit()
|
public function submit()
|
||||||
{
|
{
|
||||||
if($this->webhook_selected != 'general') {
|
if (Helper::isDemoMode()) {
|
||||||
$this->validate($this->rules);
|
session()->flash('error',trans('general.feature_disabled'));
|
||||||
|
} else {
|
||||||
|
if ($this->webhook_selected != 'general') {
|
||||||
|
$this->validate($this->rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setting->webhook_selected = $this->webhook_selected;
|
||||||
|
$this->setting->webhook_endpoint = $this->webhook_endpoint;
|
||||||
|
$this->setting->webhook_channel = $this->webhook_channel;
|
||||||
|
$this->setting->webhook_botname = $this->webhook_botname;
|
||||||
|
|
||||||
|
$this->setting->save();
|
||||||
|
|
||||||
|
session()->flash('success',trans('admin/settings/message.update.success'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setting->webhook_selected = $this->webhook_selected;
|
|
||||||
$this->setting->webhook_endpoint = $this->webhook_endpoint;
|
|
||||||
$this->setting->webhook_channel = $this->webhook_channel;
|
|
||||||
$this->setting->webhook_botname = $this->webhook_botname;
|
|
||||||
|
|
||||||
$this->setting->save();
|
|
||||||
|
|
||||||
session()->flash('save',trans('admin/settings/message.update.success'));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ class SettingsServiceProvider extends ServiceProvider
|
||||||
// Set the monetary locale to the configured locale to make helper::parseFloat work.
|
// Set the monetary locale to the configured locale to make helper::parseFloat work.
|
||||||
setlocale(LC_MONETARY, config('app.locale'));
|
setlocale(LC_MONETARY, config('app.locale'));
|
||||||
setlocale(LC_NUMERIC, config('app.locale'));
|
setlocale(LC_NUMERIC, config('app.locale'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -417,6 +417,6 @@ return [
|
||||||
'merged' => 'merged',
|
'merged' => 'merged',
|
||||||
'merged_log_this_user_into' => 'Merged this user (ID :to_id - :to_username) into user ID :from_id (:from_username) ',
|
'merged_log_this_user_into' => 'Merged this user (ID :to_id - :to_username) into user ID :from_id (:from_username) ',
|
||||||
'merged_log_this_user_from' => 'Merged user ID :from_id (:from_username) into this user (ID :to_id - :to_username)',
|
'merged_log_this_user_from' => 'Merged user ID :from_id (:from_username) into this user (ID :to_id - :to_username)',
|
||||||
|
'clear_and_save' => 'Clear & Save',
|
||||||
|
|
||||||
];
|
];
|
|
@ -12,33 +12,33 @@
|
||||||
{{-- Page content --}}
|
{{-- Page content --}}
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div>
|
<div><!-- livewire div - do not remove -->
|
||||||
<form class="form-horizontal" role="form" wire:submit.prevent="submit">
|
<form class="form-horizontal" role="form" wire:submit.prevent="submit">
|
||||||
{{csrf_field()}}
|
{{csrf_field()}}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
|
<div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
|
||||||
<div class="panel box box-default">
|
|
||||||
<div class="box-header with-border">
|
<div class="panel box box-default">
|
||||||
<h2 class="box-title">
|
|
||||||
<i class="{{$webhook_icon}}"></i> {{ trans('admin/settings/general.webhook', ['app' => $webhook_name] ) }}
|
<div class="box-header with-border">
|
||||||
</h2>
|
<h2 class="box-title">
|
||||||
</div>
|
<i class="{{$webhook_icon}}"></i> {{ trans('admin/settings/general.webhook', ['app' => $webhook_name] ) }}
|
||||||
<div class="box-body">
|
</h2>
|
||||||
<div class="col-md-12">
|
</div>
|
||||||
@if($webhook_selected != 'general')
|
|
||||||
<p>
|
<div class="box-body">
|
||||||
{!! trans('admin/settings/general.webhook_integration_help',array('webhook_link' => $webhook_link, 'app' => $webhook_name)) !!}
|
@if($webhook_selected != 'general')
|
||||||
</p>
|
<div class="col-md-12">
|
||||||
@endif
|
<p>
|
||||||
<br>
|
{!! trans('admin/settings/general.webhook_integration_help',array('webhook_link' => $webhook_link, 'app' => $webhook_name)) !!}
|
||||||
</div>
|
</p>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="col-md-12" style="border-top: 0px;">
|
<div class="col-md-12" style="border-top: 0px;">
|
||||||
@if (session()->has('save'))
|
|
||||||
<div class="alert alert-success fade in">
|
|
||||||
{{session('save')}}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if(session()->has('success'))
|
@if(session()->has('success'))
|
||||||
<div class="alert alert-success fade in">
|
<div class="alert alert-success fade in">
|
||||||
|
@ -50,130 +50,135 @@
|
||||||
{{session('error')}}
|
{{session('error')}}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if(session()->has('message'))
|
|
||||||
<div class="alert alert-danger fade in">
|
<div class="form-group">
|
||||||
{{session('message')}}
|
<div class="col-md-2">
|
||||||
|
<label for="webhook_selected">
|
||||||
|
{{ trans('general.integration_option') }}
|
||||||
|
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-9 required" wire:ignore>
|
||||||
|
|
||||||
|
{{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:90%')) }}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (Helper::isDemoMode())
|
||||||
|
@include('partials.forms.demo-mode')
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!--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">
|
||||||
|
<input type="text" wire:model="webhook_endpoint" class="form-control" placeholder="{{$webhook_placeholder}}" value="{{old('webhook_endpoint', $webhook_endpoint)}}"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
||||||
|
{!! $errors->first('webhook_endpoint', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (Helper::isDemoMode())
|
||||||
|
@include('partials.forms.demo-mode')
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group" style="margin-left:-14px;">
|
<!-- Webhook channel -->
|
||||||
<div class="col-md-3">
|
<div class="form-group{{ $errors->has('webhook_channel') ? ' error' : '' }}">
|
||||||
<label for="webhook_selected">
|
<div class="col-md-2">
|
||||||
{{ trans('general.integration_option') }}
|
{{ Form::label('webhook_channel', trans('admin/settings/general.webhook_channel',['app' => $webhook_name ])) }}
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-9 required">
|
||||||
|
<input type="text" wire:model="webhook_channel" class="form-control" placeholder="#IT-Ops" value="{{ old('webhook_channel', $webhook_channel) }}"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
||||||
|
|
||||||
<div class="col-md-8" style="margin-left: -62px;">
|
{!! $errors->first('webhook_channel', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||||
<select wire:model="webhook_selected" aria-label="webhook_selected" class="form-control">
|
|
||||||
<option value="slack">{{ trans('admin/settings/general.slack') }}</option>
|
|
||||||
<option value="general">{{ trans('admin/settings/general.general_webhook') }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<br><br><br>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<form class="form-horizontal" role="form" wire:submit.prevent="submit">
|
|
||||||
{{csrf_field()}}
|
|
||||||
|
|
||||||
<!--Webhook endpoint-->
|
@if (Helper::isDemoMode())
|
||||||
<div class="form-group{{ $errors->has('webhook_endpoint') ? ' error' : '' }}">
|
@include('partials.forms.demo-mode')
|
||||||
<div class="col-md-2">
|
@endif
|
||||||
{{ Form::label('webhook_endpoint', trans('admin/settings/general.webhook_endpoint',['app' => $webhook_name ])) }}
|
|
||||||
</div>
|
<!-- Webhook botname -->
|
||||||
<div class="col-md-8 required">
|
<div class="form-group{{ $errors->has('webhook_botname') ? ' error' : '' }}">
|
||||||
@if (config('app.lock_passwords')===true)
|
<div class="col-md-2">
|
||||||
<p class="text-warning"><i
|
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }}
|
||||||
class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
|
||||||
<input type="text" wire:model="webhook_endpoint" class='form-control'
|
|
||||||
placeholder="{{$webhook_placeholder}}"
|
|
||||||
value="{{old('webhook_endpoint', $webhook_endpoint)}}">
|
|
||||||
@else
|
|
||||||
<input type="text" wire:model="webhook_endpoint" class='form-control'
|
|
||||||
placeholder="{{$webhook_placeholder}}"
|
|
||||||
value="{{old('webhook_endpoint', $webhook_endpoint)}}">
|
|
||||||
@endif
|
|
||||||
{!! $errors->first('webhook_endpoint', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input type="text" wire:model="webhook_botname" class='form-control' placeholder="Snipe-Bot" {{ old('webhook_botname', $webhook_botname)}}{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
||||||
|
{!! $errors->first('webhook_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||||
|
</div><!--col-md-10-->
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Webhook channel -->
|
@if (!Helper::isDemoMode())
|
||||||
<div class="form-group{{ $errors->has('webhook_channel') ? ' error' : '' }}">
|
@include('partials.forms.demo-mode')
|
||||||
<div class="col-md-2">
|
@endif
|
||||||
{{ Form::label('webhook_channel', trans('admin/settings/general.webhook_channel',['app' => $webhook_name ])) }}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8 required">
|
|
||||||
@if (config('app.lock_passwords')===true)
|
|
||||||
<input type="text" wire:model="webhook_channel" class='form-control'
|
|
||||||
placeholder="#IT-Ops"
|
|
||||||
value="{{old('webhook_channel', $webhook_channel)}}">
|
|
||||||
<p class="text-warning"><i
|
|
||||||
class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
|
||||||
@else
|
|
||||||
<input type="text" wire:model="webhook_channel" class='form-control'
|
|
||||||
placeholder="#IT-Ops"
|
|
||||||
value="{{old('webhook_channel', $webhook_channel)}}">
|
|
||||||
@endif
|
|
||||||
{!! $errors->first('webhook_channel', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Webhook botname -->
|
<!--Webhook Integration Test-->
|
||||||
<div class="form-group{{ $errors->has('webhook_botname') ? ' error' : '' }}">
|
@if($webhook_selected == 'slack')
|
||||||
<div class="col-md-2">
|
@if($webhook_endpoint != null && $webhook_channel != null)
|
||||||
{{ Form::label('webhook_botname', trans('admin/settings/general.webhook_botname',['app' => $webhook_name ])) }}
|
<div class="form-group">
|
||||||
</div>
|
<div class="col-md-offset-2 col-md-9">
|
||||||
<div class="col-md-8">
|
<a href="#" wire:click.prevent="testWebhook"
|
||||||
@if (config('app.lock_passwords')===true)
|
class="btn btn-default btn-sm pull-left">
|
||||||
<input type="text" wire:model="webhook_botname" class='form-control'
|
<i class="{{$webhook_icon}}" aria-hidden="true"></i>
|
||||||
placeholder="Snipe-Bot" {{old('webhook_botname', $webhook_botname)}}>
|
{!! trans('admin/settings/general.webhook_test',['app' => ucwords($webhook_selected) ]) !!}
|
||||||
<p class="text-warning"><i class="fas fa-lock"></i>
|
</a>
|
||||||
{{ trans('general.feature_disabled') }}
|
<div wire:loading>
|
||||||
</p>
|
<span style="padding-left: 5px; font-size: 20px">
|
||||||
@else
|
<i class="fas fa-spinner fa-spin" aria-hidden="true"></i>
|
||||||
<input type="text" wire:model="webhook_botname" class='form-control'
|
</span>
|
||||||
placeholder="Snipe-Bot" {{old('webhook_botname', $webhook_botname)}}>
|
|
||||||
@endif
|
|
||||||
{!! $errors->first('webhook_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
|
||||||
</div><!--col-md-10-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--Webhook Integration Test-->
|
|
||||||
@if($webhook_selected == 'slack')
|
|
||||||
@if($webhook_endpoint != null && $webhook_channel != null)
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-8">
|
|
||||||
<a href="#" wire:click.prevent="testWebhook"
|
|
||||||
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>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="box-footer" style="margin-top: 45px;">
|
|
||||||
<div class="text-right col-md-12">
|
|
||||||
<button type="reset" wire:click.prevent="clearSettings" class="col-md-2 text-left btn btn-danger">Clear & Save</button>
|
|
||||||
|
|
||||||
<a class="btn btn-link text-left"
|
|
||||||
href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
|
||||||
<button type="submit" {{$isDisabled}} class="btn btn-primary"><i
|
|
||||||
class="fas fa-check icon-white"
|
|
||||||
aria-hidden="true"></i> {{ $save_button }}</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div><!--box-footer-->
|
@endif
|
||||||
|
@endif
|
||||||
|
</div><!-- /.col-md-12 -->
|
||||||
|
</div><!-- /.box-body -->
|
||||||
|
|
||||||
|
<div class="box-footer">
|
||||||
|
<div class="text-right col-md-12">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<a class="btn btn-link pull-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||||
|
|
||||||
|
|
||||||
|
<button type="submit" {{$isDisabled}} class="btn btn-primary"{{ Helper::isDemoMode() ? ' disabled' : ''}}>
|
||||||
|
<i class="fas fa-check icon-white" aria-hidden="true"></i> {{ $save_button }}</button>
|
||||||
|
|
||||||
|
</div> <!-- /.col-md-12 -->
|
||||||
|
</div><!--box-footer-->
|
||||||
|
|
||||||
|
</div> <!-- /.box -->
|
||||||
|
</div> <!-- /.col-md-8-->
|
||||||
|
</div> <!-- /.row -->
|
||||||
|
</form>
|
||||||
|
</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
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- /box -->
|
|
||||||
</div> <!-- /.col-md-8-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
5
resources/views/partials/forms/demo-mode.blade.php
Normal file
5
resources/views/partials/forms/demo-mode.blade.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-10 col-md-offset-2">
|
||||||
|
{!! Helper::showDemoModeFieldWarning() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in a new issue