@extends('layouts.app') @section('title',$project->name) @section('content')<p class="text-sm font-semibold text-blue-600">{{ $project->code }}</p><h1 class="text-3xl font-black">{{ $project->name }}</h1><p class="mt-2 max-w-3xl text-slate-600">{{ $project->description }}</p><div class="mt-6 grid gap-6 lg:grid-cols-2"><div class="card"><div class="border-b p-5 font-bold">Project team</div>@foreach($project->members as $m)<div class="flex items-center justify-between border-b px-5 py-4 last:border-0"><div><p class="font-semibold">{{ $m->user->name }}</p><p class="text-xs text-slate-500">{{ $m->role }}</p></div><span class="badge">{{ $m->allocation_percent }}%</span></div>@endforeach</div><div class="card"><div class="border-b p-5 font-bold">Tasks</div>@foreach($project->tasks->take(15) as $t)<div class="flex items-center justify-between border-b px-5 py-4 last:border-0"><div><p class="font-semibold">{{ $t->title }}</p><p class="text-xs text-slate-500">{{ $t->assignee?->name }}</p></div><span class="badge">{{ $t->status }}</span></div>@endforeach</div></div><div class="mt-6 grid gap-6 lg:grid-cols-2">
  <!-- Form 1: Assign member -->
  <form method="POST" action="{{ route('projects.members.store',$project) }}" class="card p-6 flex flex-col gap-4">
    @csrf
    <h3 class="text-lg font-bold text-slate-800">Assign Project Member</h3>
    
    <div>
        <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Developer / User</label>
        <select class="input" name="user_id">
          @foreach($users as $u)
            <option value="{{ $u->id }}">{{ $u->name }}</option>
          @endforeach
        </select>
    </div>
    
    <div>
        <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Project Role</label>
        <input class="input" name="role" placeholder="e.g. Backend Engineer, QA" required>
    </div>
    
    <div>
        <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Allocation Percentage</label>
        <input class="input" type="number" min="1" max="100" name="allocation_percent" value="100">
    </div>
    
    <button class="btn btn-primary mt-2">Assign Member</button>
  </form>

  <!-- Form 2: Create task -->
  <form method="POST" action="{{ route('tasks.store') }}" class="card p-6 flex flex-col gap-4">
    @csrf
    <input type="hidden" name="project_id" value="{{ $project->id }}">
    <h3 class="text-lg font-bold text-slate-800">Add Project Task</h3>
    
    <div>
        <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Task Title</label>
        <input class="input" name="title" placeholder="e.g. Implement API endpoint" required>
    </div>
    
    <div>
        <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Assignee</label>
        <select class="input" name="primary_assignee_id">
          <option value="">Unassigned</option>
          @foreach($project->members as $m)
            <option value="{{ $m->user->id }}">{{ $m->user->name }} ({{ $m->role }})</option>
          @endforeach
        </select>
    </div>
    
    <div class="grid grid-cols-2 gap-3">
        <div>
            <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Priority</label>
            <select class="input" name="priority">
              <option value="medium">Medium</option>
              <option value="high">High</option>
              <option value="low">Low</option>
            </select>
        </div>
        <div>
            <label class="block text-[10px] font-bold uppercase tracking-wider text-slate-400 mb-1.5">Due Date</label>
            <input class="input" type="date" name="due_date">
        </div>
    </div>
    
    <button class="btn btn-primary mt-2">Create Task</button>
  </form>
</div>
@endsection