diff --git a/app/Http/Livewire/SlackSettingsForm.php b/app/Http/Livewire/SlackSettingsForm.php index 0193aa7daf..42d5a70824 100644 --- a/app/Http/Livewire/SlackSettingsForm.php +++ b/app/Http/Livewire/SlackSettingsForm.php @@ -4,23 +4,46 @@ namespace App\Http\Livewire; use Livewire\Component; use App\Models\Setting; +use App\Http\Requests\Request; class SlackSettingsForm extends Component { + public $slack_endpoint; + public $slack_channel; + public $slack_botname; + public Setting $setting; protected $rules = [ - 'setting.slack_endpoint' => 'url|required_with:slack_channel|starts_with:https://hooks.slack.com/|nullable', - 'setting.slack_channel' => 'required_with:slack_endpoint|starts_with:#|nullable', - 'setting.slack_botname' => 'string|nullable', + 'slack_endpoint' => 'url|required_with:slack_channel|starts_with:https://hooks.slack.com/|nullable', + 'slack_channel' => 'required_with:slack_endpoint|starts_with:#|nullable', + 'slack_botname' => 'string|nullable', ]; + public function mount(){ + + $this->setting= Setting::getSettings(); + $this->slack_endpoint = $this->setting->slack_endpoint; + $this->slack_channel = $this->setting->slack_channel; + $this->slack_botname = $this->setting->slack_botname; + + } public function render() { return view('livewire.slack-settings-form'); } + public function submit() + { + + $this->validate(); + + $this->setting->slack_endpoint = $this->slack_endpoint; + $this->setting->slack_channel = $this->slack_channel; + $this->setting->slack_botname = $this->slack_botname; + + } } diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index 4846aa95fb..cd7978f08e 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -8,13 +8,49 @@ @if (config('app.lock_passwords')===true) {{-- {{ Form::text('slack_endpoint', old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX', 'id' => 'slack_endpoint')) }}--}}

{{ trans('general.feature_disabled') }}

- slack_endpoint)}} > + @else - slack_endpoint)}} > + {{-- {{ Form::text('slack_endpoint', old('slack_endpoint', $setting->slack_endpoint), array('class' => 'form-control','placeholder' => 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX', 'id' => 'slack_endpoint')) }}--}} @endif {!! $errors->first('slack_endpoint', '') !!} + + +
+
+ {{ Form::label('slack_channel', trans('admin/settings/general.slack_channel')) }} +
+
+ @if (config('app.lock_passwords')===true) + +

{{ trans('general.feature_disabled') }}

+ + @else + + @endif + {!! $errors->first('slack_channel', '') !!} +
+
+ + +
+
+ {{ Form::label('slack_botname', trans('admin/settings/general.slack_botname')) }} +
+
+ @if (config('app.lock_passwords')===true) + {{ Form::text('slack_botname', old('slack_botname', $setting->slack_botname), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'Snipe-Bot')) }} + + +

{{ trans('general.feature_disabled') }}

+ + @else + + @endif + {!! $errors->first('slack_botname', '') !!} +
+
diff --git a/resources/views/settings/slack.blade.php b/resources/views/settings/slack.blade.php index f5f21c5aa9..6bbd321662 100644 --- a/resources/views/settings/slack.blade.php +++ b/resources/views/settings/slack.blade.php @@ -50,41 +50,9 @@
- @livewire('slack-settings-form', ['setting' => $setting]) + @livewire('slack-settings-form') - -
-
- {{ Form::label('slack_channel', trans('admin/settings/general.slack_channel')) }} -
-
- @if (config('app.lock_passwords')===true) - {{ Form::text('slack_channel', old('slack_channel', $setting->slack_channel), array('class' => 'form-control','disabled'=>'disabled','placeholder' => '#IT-Ops')) }} -

{{ trans('general.feature_disabled') }}

- @else - {{ Form::text('slack_channel', old('slack_channel', $setting->slack_channel), array('class' => 'form-control','placeholder' => '#IT-Ops')) }} - @endif - {!! $errors->first('slack_channel', '') !!} -
-
- - -
-
- {{ Form::label('slack_botname', trans('admin/settings/general.slack_botname')) }} -
-
- @if (config('app.lock_passwords')===true) - {{ Form::text('slack_botname', old('slack_botname', $setting->slack_botname), array('class' => 'form-control','disabled'=>'disabled','placeholder' => 'Snipe-Bot')) }} -

{{ trans('general.feature_disabled') }}

- - @else - {{ Form::text('slack_botname', old('slack_botname', $setting->slack_botname), array('class' => 'form-control','placeholder' => 'Snipe-Bot')) }} - @endif - {!! $errors->first('slack_botname', '') !!} -
-