<div>

    <form wire:submit.prevent="onTermsAndConditionGenerator">

        <div>
            <!-- Session Status -->
            <x-auth-session-status class="mb-4" :status="session('status')" />

            <!-- Validation Errors -->
            <x-auth-validation-errors class="mb-4" :errors="$errors" />
        </div>

        <div class="row">
            <div class="col-12 col-md-6">
                <div class="mb-3">
                    <label class="form-label">{{ __('Company Name') }}</label>
                    <input type="text" class="form-control" wire:model.defer="company_name" placeholder="{{ __('Enter a name') }}" required>
                </div>
            </div>

            <div class="col-12 col-md-6">
                <div class="mb-3">
                    <label class="form-label">{{ __('Website URL') }}</label>
                    <input type="text" class="form-control" wire:model.defer="website_url" placeholder="{{ __('Enter website URL') }}" required>
                </div>
            </div>
        </div>

        @if ($generalSettings->captcha_status && ($generalSettings->captcha_for_registered || !auth()->check()))
        <x-public.recaptcha />
        @endif

        <button class="btn bg-gradient-info mx-auto d-block mb-0" wire:loading.attr="disabled">
            <span>
                <div wire:loading.inline wire:target="onTermsAndConditionGenerator">
                    <x-loading />
                </div>
                <span>{{ __('Generate') }}</span>
            </span>
        </button>

        @if ( !empty($data) )
            <div class="form-group position-relative mt-3 mb-0">
                <textarea id="result" class="form-control" rows="10">{{ $data['text'] }}</textarea>
                <a onclick="copyToClipboard()" class="btn btn-icon-only btn-success cursor-pointer position-absolute top-0 end-0 m-2" title="{{ __('Copy') }}" data-bs-toggle="tooltip" data-bs-original-title="{{ __('Copy') }}">
                    <i class="fas fa-copy"></i>
                </a>
            </div>
        @endif
    </form>

	<script>
	  function copyToClipboard() {
		document.getElementById("result").select();
		document.execCommand('copy');
	  }
	</script>
</div>
