@extends('template.app')

@section('meta')
@endsection

@section('title')
   View Ticket
@endsection

@section('styles')
<link href="{{ asset('assets/css/dropify.min.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/sweetalert2.bundle.css') }}" rel="stylesheet">
@endsection

@section('content')
<div class="page-breadcrumb">
    <div class="row">
        <div class="col-7 align-self-center">
            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Ticket</h4>
            <div class="d-flex align-items-center">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb m-0 p-0">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                     
                        <li class="breadcrumb-item text-muted active" aria-current="page">View Ticket</li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('ticket.update') }}" name="form" id="form" method="post" enctype="multipart/form-data">
                        @csrf
                        @method('PATCH')
                        
                      @if(session('message'))
                            <div class="alert alert-success">
                                {{ session('message') }}
                            </div>
                        @endif

                        <div class="row">
                          
                             <div class="form-group col-sm-5">
                                <label for="password">Name</label>
                                <input type="test" name="name" value="{{$data->user->first_name . ' ' . $data->user->last_name}}" class="form-control" placeholder="Please enter title" readonly>
                                <span class="kt-form__help error password"></span>
                            </div>
                            <div class="form-group col-sm-5">
                                <label for="password">Title</label>
                                <input type="test" name="title" class="form-control" placeholder="Please enter title" value="{{ $data->title }}" readonly>
                                <span class="kt-form__help error password"></span>
                            </div>
                            <div class="form-group col-sm-5">
                                <label for="password">Description</label>
                                <textarea name="description" class="form-control"readonly>{{ $data->description }}</textarea>
                                <span class="kt-form__help error password"></span>
                            </div>
                         
                          <div class="form-group col-sm-5">
                                <label for="password">Contact </label>
                                <input type="number" name="contact" class="form-control" value="{{ $data->contact }}" readonly placeholder="Please enter Contact No">
                                <span class="kt-form__help error password"></span>
                            </div>
                               <div class="form-group col-sm-5">
                                <label for="password">email</label>
                                <input type="test" name="email" class="form-control" placeholder="Please enter Email" value="{{ $data->email_id }}" readonly>
                                <span class="kt-form__help error password"></span>
                            </div>
                            @if(auth()->user()->id == 1)
                            <div class="form-group col-sm-5">
                                <label for="password">Comment</label>
                                <textarea name="comment" class="form-control" placeholder="Please enter Comment"></textarea>
                                <span class="kt-form__help error password"></span>
                            </div>
                            @else
                            <div class="form-group col-sm-5">
                                <label for="password">Comment</label>
                                <textarea name="comment" class="form-control" placeholder="Please enter Comment" readonly>{{ $data->comment }}</textarea>
                                <span class="kt-form__help error password"></span>
                            </div>
                            @endif
                            @if(auth()->user()->id == 1)
                            <div class="form-group col-sm-5">
                                <label for="password">Status</label>
                                <select name="status" class="form-control">
                                    <option value="">Select Status</option>
                                    <option value="Working in Progress"{{ $data->status == 'Working in Progress' ? ' selected' : '' }}>Working in Progress</option>
                                    <option value="Closed"{{ $data->status == 'Closed' ? ' selected' : '' }}>Closed</option>
                                    <option value="completed"{{ $data->status == 'completed' ? ' selected' : '' }}>Completed</option>
                                    <option value="Pending for client testing"{{ $data->status == 'Pending for client testing' ? ' selected' : '' }}>Pending for client testing</option>
                                    <option value="Open"{{ $data->status == 'Open' ? ' selected' : '' }}>Open</option>
                                </select>
                                <span class="kt-form__help error password"></span>
                            </div>
                            @else 
                             <div class="form-group col-sm-5">
                                <label for="password">Status</label>
                                <input type="text" value="{{ $data->status }}" name="status" class="form-control"readonly>
                                <span class="kt-form__help error password"></span>
                            </div>
                            @endif
                            <div class="form-group col-sm-5">
                                <label for="password">Tech Team Reamrk</label>
                                <textarea name="description" class="form-control"readonly>{{ $data->remark }}</textarea>
                                <span class="kt-form__help error password"></span>
                            </div>
                        </div>
                        <input type="hidden" value="{{ $data->id }}" name="id">
                         @if(auth()->user()->id == 1)
                        <div class="form-group">
                            <button type="submit" class="btn waves-effect waves-light btn-rounded btn-outline-primary">Submit</button>
                            <a href="{{ route('dashboard') }}" class="btn waves-effect waves-light btn-rounded btn-outline-secondary">Cancel</a>
                        </div>
                        @endif
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('scripts')
<script src="{{ asset('assets/js/dropify.min.js') }}"></script>
<script src="{{ asset('assets/js/promise.min.js') }}"></script>
<script src="{{ asset('assets/js/sweetalert2.bundle.js') }}"></script>

<script>
   
</script>
@endsection