@extends('layouts.master')

<?php $result = '' ; 
	foreach($song->artists->all() as $artist) {
		$result .= $artist->name." & " ;
	}
	$result = substr($result, 0,-2) ;
?>

@section('content')

<div>
	<h3 style="font-weight: 800; margin-bottom: 5px;">تصحيح كلمات أغنية</h3>
	<hr>
	<form method="POST" action="/songs">
		@csrf

		<p style="font-weight: 800; color: #7777CC; font-size: 1.05em;">تريد أن:</p>
		<div class="form-check form-check-inline">
			<input class="form-check-input" type="radio" id="inlineCheckbox1" name="type" value="addition" disabled>
			<label class="form-check-label" for="inlineCheckbox1">إرسال كلمات</label>
		</div>
		<div class="form-check form-check-inline">
			<input class="form-check-input" type="radio" id="inlineCheckbox2" name="type" value="correction" checked>
			<label class="form-check-label" for="inlineCheckbox2">تصحيح كلمات</label>
		</div>

		<div class="form-group" style="margin-top: 1rem;">
			<label for="artist">الفنان:</label>
			<input type="text" class="form-control" id="artist" name="artist" value="{{$result}}">
			@if ($errors->has('artist'))
			<div class="alert alert-danger mt-1">{{ $errors->first('artist') }}</div>
			@endif
		</div>

		<div class="form-group">
			<label for="song">عنوان الأغنية:</label>
			<input type="text" class="form-control" id="song" name="song" value="{{$song->title}}">
			@if ($errors->has('song'))
			<div class="alert alert-danger mt-1">{{ $errors->first('song') }}</div>
			@endif
		</div>

		<div class="form-group">
			<label for="lyrics">الكلمات:</label>
			<textarea class="form-control" name="lyrics" rows="20">{{$song->lyrics}}</textarea>
			@if ($errors->has('lyrics'))
			<div class="alert alert-danger mt-1">{{ $errors->first('lyrics') }}</div>
			@endif
		</div>

		@php $recaptchaEnabled = \App\SiteSetting::get('recaptcha_enabled', '0'); $recaptchaSiteKey = \App\SiteSetting::get('recaptcha_site_key', ''); @endphp
		@if($recaptchaEnabled == '1' && $recaptchaSiteKey)
		<div style="padding: 10px 0; display: flex; justify-content: center;">
			<div class="g-recaptcha" data-sitekey="{{ $recaptchaSiteKey }}"></div>
		</div>
		@if ($errors->has('g-recaptcha-response'))
			<div style="color: #cc0000; font-size: 0.85em; text-align: center; margin-bottom: 5px;">{{ $errors->first('g-recaptcha-response') }}</div>
		@endif
		@endif

		<div class="form-group" style="text-align: center;">
			<button type="submit" class="btn btn-primary" name="submit">إرسال التصحيح</button>
		</div>
	</form>
</div>

@endsection
