mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
greys out submit button conditionally
This commit is contained in:
parent
221f5f5ca7
commit
7b510d5f2b
|
@ -11,6 +11,7 @@ class SlackSettingsForm extends Component
|
|||
public $slack_endpoint;
|
||||
public $slack_channel;
|
||||
public $slack_botname;
|
||||
public $isDisabled ='disabled' ;
|
||||
|
||||
public Setting $setting;
|
||||
|
||||
|
@ -35,6 +36,9 @@ class SlackSettingsForm extends Component
|
|||
|
||||
public function render()
|
||||
{
|
||||
if(empty($this->slack_channel || $this->slack_endpoint)){
|
||||
$this->isDisabled= 'disabled';
|
||||
}
|
||||
return view('livewire.slack-settings-form');
|
||||
}
|
||||
|
||||
|
@ -57,9 +61,11 @@ class SlackSettingsForm extends Component
|
|||
|
||||
try {
|
||||
$slack->post($this->slack_endpoint, ['body' => $payload]);
|
||||
$this->isDisabled='';
|
||||
return session()->flash('success' , 'Your Slack Integration works!');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->isDisabled= 'disabled';
|
||||
return session()->flash('error' , trans('admin/settings/message.slack.error', ['error_message' => $e->getMessage()]));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<div class="col-md-2">
|
||||
{{ Form::label('slack_botname', trans('admin/settings/general.slack_botname')) }}
|
||||
</div>
|
||||
<div class="col-md-8 required">
|
||||
<div class="col-md-8">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<input type="text" wire:model.lazy="slack_botname" class= 'form-control' placeholder="Snipe-Bot" {{old('slack_botname', $slack_botname)}}>
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<div class="box-footer" style="margin-top: 45px;">
|
||||
<div class="text-right col-md-12">
|
||||
<a class="btn btn-link text-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
|
||||
<button type="submit" {{$isDisabled}} class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
</div><!--box-footer-->
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue