@extends('admin.layout')
@section('heading','Website Ads')
@section('content')
<div class="panel ad-guide">
    <h2>Banner & Direct-Link Ads</h2>
    <p class="hint">Banner slots accept authorized HTML/JS. The <b>Player Sponsored Action</b> direct URL controls the player click, Watch Now action, and every 480p/720p/1080p/2K/4K download button on movie pages.</p>
</div>
<div class="two-col ads-layout">
<form class="panel form-grid" method="post" action="{{route('admin.ads.store')}}">@csrf
<h2>Add Advertisement</h2>
<label>Name<input name="name" required placeholder="Player sponsor link"></label>
<label>Placement<select name="slot" required>
<option value="home_top">Home Top</option><option value="home_bottom">Home Bottom</option><option value="list_top">List Top</option><option value="list_bottom">List Bottom</option><option value="details_top">Details Top</option><option value="details_bottom">Details Bottom</option><option value="player_sponsor">Player Sponsored Action + Download Buttons</option><option value="global_script">Global Script (all pages)</option>
</select></label>
<label>Type<select name="type"><option value="banner">Banner HTML / JS</option><option value="direct">Direct sponsored link</option><option value="script">Global script</option></select></label>
<label>Direct URL<input name="target_url" type="url" placeholder="https://advertiser.example/..."></label>
<label class="full">Banner HTML or JavaScript<textarea name="content" rows="8" placeholder="Paste authorized ad code here"></textarea></label>
<label><input type="checkbox" name="is_active" value="1" checked> Active</label><button class="primary">Save Advertisement</button>
</form>
<div class="panel"><h2>Saved Ads</h2>@forelse($items as $x)<article class="list-row"><div><b>{{$x->name}}</b><small>{{$x->slot}} · {{$x->type}}</small></div><div class="actions"><form method="post" action="{{route('admin.ads.toggle',$x)}}">@csrf<button>{{$x->is_active?'ON':'OFF'}}</button></form><form method="post" action="{{route('admin.ads.destroy',$x)}}">@csrf @method('DELETE')<button class="danger">Delete</button></form></div></article>@empty<p class="hint">No advertisements added yet.</p>@endforelse</div>
</div>
@endsection
