@extends('layouts.app')
@section('content')
<main class="nxl-container"><div class="nxl-content"><div class="page-header"><h5>Create Project</h5></div><div class="main-content">
@if($errors->any())<div class="alert alert-danger">{{ $errors->first() }}</div>@endif
<div class="card"><div class="card-body"><form method="POST" action="{{ route('projects.store') }}" class="row g-3">@csrf
<div class="col-md-8"><label class="form-label">Project Name</label><input class="form-control" name="name" value="{{ old('name') }}" required></div><div class="col-md-4"><label class="form-label">Status</label><select class="form-select" name="status">@foreach(['planned','active','on_hold','completed','cancelled'] as $s)<option value="{{ $s }}">{{ ucwords(str_replace('_',' ',$s)) }}</option>@endforeach</select></div>
<div class="col-12"><label class="form-label">Description</label><textarea class="form-control" name="description">{{ old('description') }}</textarea></div>
<div class="col-md-4"><label class="form-label">Closed Won Deal</label><select class="form-select crm-remote-lookup" data-lookup-type="won_deal" name="deal_id"><option value="">None</option></select></div>
<div class="col-md-4"><label class="form-label">Account</label><select class="form-select crm-remote-lookup" data-lookup-type="account" name="account_id"><option value="">None</option></select></div>
<div class="col-md-4"><label class="form-label">Owner</label><select class="form-select crm-remote-lookup" data-lookup-type="user" name="owner_id">@foreach($users as $user)<option value="{{ $user->id }}" selected>{{ $user->name }}</option>@endforeach</select></div>
<div class="col-md-4"><label class="form-label">Start</label><input type="date" class="form-control" name="start_date"></div><div class="col-md-4"><label class="form-label">Due</label><input type="date" class="form-control" name="due_date"></div><div class="col-md-4"><label class="form-label">Progress %</label><input type="number" min="0" max="100" value="0" class="form-control" name="progress"></div>
<div class="col-md-4"><label class="form-label">Project Manager</label><select class="form-select crm-remote-lookup" data-lookup-type="user" name="project_manager_id"><option value="">Select</option></select></div><div class="col-md-4"><label class="form-label">Project Type</label><input class="form-control" name="project_type"></div><div class="col-md-4"><label class="form-label">Priority</label><select class="form-select" name="priority"><option value="">Select</option>@foreach(['low','medium','high','urgent'] as $priority)<option value="{{ $priority }}">{{ ucfirst($priority) }}</option>@endforeach</select></div>
<div class="col-md-3"><label class="form-label">Budget</label><input type="number" step=".01" min="0" class="form-control" name="budget"></div><div class="col-md-3"><label class="form-label">Contract Value</label><input type="number" step=".01" min="0" class="form-control" name="contract_value"></div><div class="col-md-3"><label class="form-label">Billing Type</label><input class="form-control" name="billing_type"></div><div class="col-md-3"><label class="form-label">Actual End</label><input type="date" class="form-control" name="actual_end_date"></div>
<div class="col-md-6"><label class="form-label">Technology Stack</label><textarea class="form-control" name="technology_stack"></textarea></div><div class="col-md-6"><label class="form-label">Scope of Work</label><textarea class="form-control" name="scope_of_work"></textarea></div><div class="col-md-6"><label class="form-label">Requirements</label><textarea class="form-control" name="requirements"></textarea></div><div class="col-md-6"><label class="form-label">Deliverables / Risks</label><textarea class="form-control" name="deliverables"></textarea><textarea class="form-control mt-2" name="risks" placeholder="Risks"></textarea></div>
<div class="col-12"><label class="form-label">Project Employees</label><select class="form-select crm-remote-lookup" data-lookup-type="user" name="assignee_ids[]" multiple></select></div>
<div class="col-12"><button class="btn btn-primary">Create Project</button> <a class="btn btn-light" href="{{ route('projects') }}">Cancel</a></div>
</form></div></div></div></div></main>
@endsection
