﻿@extends('layouts.admin')

@section('page-title', __('Equity Awards'))

@section('action-button')
    <a href="#" data-url="{{ route('equity-awards.create') }}" data-size="lg" data-ajax-popup="true"
        data-title="{{ __('Create Equity Award') }}" class="btn btn-sm btn-primary">
        <i class="ti ti-plus"></i> {{ __('Add Equity Award') }}
    </a>
@endsection

@section('content')
    <div class="row">
        <div class="col-12">
            @include('layouts.hrm_setup')
        </div>

        <div class="col-md-12">
            <div class="card">
                <div class="card-body table-border-style">
                    <div class="table-responsive">
                        <table class="table datatable">
                            <thead>
                                <tr>
                                    <th>{{ __('Job Grade') }}</th>
                                    <th>{{ __('Award Type') }}</th>
                                    <th>{{ __('Performance Rating') }}</th>
                                    <th>{{ __('Equity Type') }}</th>
                                    <th>{{ __('Value Type') }}</th>
                                    <th>{{ __('Value Amount') }}</th>
                                    <th>{{ __('Vesting Period (Months)') }}</th>
                                    <th class="text-end">{{ __('Actions') }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                @forelse($awards as $award)
                                                            <tr>
                                                                <td>{{ $award->jobGrade?->name ?? '-' }}</td>
                                                                <td>{{ ucfirst(str_replace('_', ' ', $award->award_type)) }}</td>
                                                                <td>{{ ucfirst($award->performance_rating) }}</td>
                                                                <td>{{ ucfirst($award->equity_type) }}</td>
                                                                <td>{{ ucfirst($award->value_type) }}</td>
                                                                <td>{{ number_format($award->value_amount, 2) }}</td>
                                                                <td>{{ $award->vesting_months }}</td>
                                                                <td class="text-end">
                                                                    <div class="action-btn bg-warning ms-2">
                                                                        <a href="#" data-url="{{ route('equity-awards.edit', $award->id) }}"
                                                                            data-size="lg" data-ajax-popup="true"
                                                                            data-title="{{ __('Edit Equity Award') }}"
                                                                            class="mx-3 btn btn-sm align-items-center">
                                                                            <i class="ti ti-pencil text-white"></i>
                                                                        </a>
                                                                    </div>
                                                                    <div class="action-btn bg-danger ms-2">
                                                                        {!! Form::open([
                                        'method' => 'DELETE',
                                        'route' => ['equity-awards.destroy', $award->id],
                                        'id' => 'delete-form-' . $award->id,
                                    ]) !!}
                                                                        <a href="#" class="mx-3 btn btn-sm align-items-center bs-pass-para"
                                                                            data-confirm="{{ __('Are You Sure?') }}"
                                                                            data-confirm-yes="document.getElementById('delete-form-{{ $award->id }}').submit();">
                                                                            <i class="ti ti-trash text-white"></i>
                                                                        </a>
                                                                        {!! Form::close() !!}
                                                                    </div>
                                                                </td>
                                                            </tr>
                                @empty
                                    <tr>
                                        <td colspan="8" class="text-center">{{ __('No equity awards found') }}</td>
                                    </tr>
                                @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsect