|
| 1 | +@extends('layouts.app') |
| 2 | + |
| 3 | +@section('content') |
| 4 | +<div class="container" id="project_container"> |
| 5 | + <br> |
| 6 | + @include('finance.menu', ['active' => 'projects']) |
| 7 | + <br><br> |
| 8 | + <div class="row"> |
| 9 | + <div class="col-md-6"><h1>Edit Project</h1></div> |
| 10 | + <div class="col-md-6"><a href="{{ route('projects.create') }}" class="btn btn-success float-right">Create Project</a></div> |
| 11 | + </div> |
| 12 | + |
| 13 | + |
| 14 | + @include('status', ['errors' => $errors->all()]) |
| 15 | + <div class="card"> |
| 16 | + <form action="{{ route('projects.update', $project->id) }}" method="POST"> |
| 17 | + |
| 18 | + {{ csrf_field() }} |
| 19 | + {{ method_field('PUT') }} |
| 20 | + |
| 21 | + <div class="card-header"> |
| 22 | + <span>Project Details</span> |
| 23 | + </div> |
| 24 | + <div class="card-body"> |
| 25 | + <div class="form-row"> |
| 26 | + <div class="form-group col-md-5"> |
| 27 | + <label for="name" class="field-required">Name</label> |
| 28 | + <input type="text" class="form-control" name="name" id="name" placeholder="Name" required="required" value="{{ $project->name }}"> |
| 29 | + </div> |
| 30 | + <div class="form-group offset-md-1 col-md-5"> |
| 31 | + <label for="client_id" class="field-required">Client</label> |
| 32 | + <select name="client_id" id="client_id" class="form-control" required="required"> |
| 33 | + @foreach ($clients as $client) |
| 34 | + @php |
| 35 | + $selected = $client->id === $project->client_id ? 'selected="selected"' : ''; |
| 36 | + @endphp |
| 37 | + <option value="{{ $client->id }}" {{ $selected }}>{{ $client->name }}</option> |
| 38 | + @endforeach |
| 39 | + </select> |
| 40 | + </div> |
| 41 | + </div> |
| 42 | + <br> |
| 43 | + <div class="form-row"> |
| 44 | + <div class="form-group col-md-5"> |
| 45 | + <label for="client_project_id" class="field-required">Project ID</label> |
| 46 | + <input type="text" class="form-control" name="client_project_id" id="client_project_id" placeholder="Project ID" required="required" value="{{ $project->client_project_id }}"> |
| 47 | + </div> |
| 48 | + <div class="form-group offset-md-1 col-md-5"> |
| 49 | + <label for="name" class="field-required">Status</label> |
| 50 | + <select name="status" id="status" class="form-control" required="required"> |
| 51 | + @foreach (config('constants.project.status') as $status => $display_name) |
| 52 | + @php |
| 53 | + $selected = $status === $project->status ? 'selected="selected"' : ''; |
| 54 | + @endphp |
| 55 | + <option value="{{ $status }}" {{ $selected }}>{{ $display_name }}</option> |
| 56 | + @endforeach |
| 57 | + </select> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + <br> |
| 61 | + <div class="form-row"> |
| 62 | + <div class="form-group col-md-5"> |
| 63 | + <label for="invoice_email">Email for invoice</label> |
| 64 | + <input type="email" class="form-control" name="invoice_email" id="invoice_email" placeholder="Email for invoice" value="{{ $project->invoice_email }}"> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + <div class="card-footer"> |
| 69 | + <button type="submit" class="btn btn-primary">Update</button> |
| 70 | + </div> |
| 71 | + </form> |
| 72 | + </div> |
| 73 | + @if (sizeof($project->stages)) |
| 74 | + <h2 class="mt-5">Project Stages</h2> |
| 75 | + @foreach ($project->stages as $stage) |
| 76 | + <project-stage-component |
| 77 | + :stage="{{ json_encode($stage) }}" |
| 78 | + :configs="{{ json_encode([ |
| 79 | + 'currencies' => config('constants.currency'), |
| 80 | + 'projectTypes' => config('constants.project.type'), |
| 81 | + 'gst' => config('constants.finance.gst'), |
| 82 | + 'invoiceStatus' => config('constants.finance.invoice.status'), |
| 83 | + 'chequeStatus' => config('constants.cheque_status'), |
| 84 | + 'paymentTypes' => config('constants.payment_types'), |
| 85 | + 'countries' => config('constants.countries') |
| 86 | + ]) }}" |
| 87 | + :client="{{ json_encode($project->client) }}" |
| 88 | + :csrf-token="{{ json_encode(csrf_token()) }}" |
| 89 | + :project-id="{{ $project->id }}" |
| 90 | + :stage-route="{{json_encode( route('project.stage'))}}" |
| 91 | + ref="projectStage"> |
| 92 | + </project-stage-component> |
| 93 | + @endforeach |
| 94 | + @endif |
| 95 | + <project-stage-component |
| 96 | + v-show="newStage" |
| 97 | + :stage="[]" |
| 98 | + :stage-route="{{json_encode( route('project.stage'))}}" |
| 99 | + :csrf-token="{{ json_encode(csrf_token()) }}" |
| 100 | + :project-id="{{ $project->id }}" |
| 101 | + :client="{{ json_encode($project->client) }}" |
| 102 | + :configs="{{ json_encode([ |
| 103 | + 'currencies' => config('constants.currency'), |
| 104 | + 'projectTypes' => config('constants.project.type'), |
| 105 | + 'gst' => config('constants.finance.gst'), |
| 106 | + 'invoiceStatus' => config('constants.finance.invoice.status'), |
| 107 | + 'chequeStatus' => config('constants.cheque_status'), |
| 108 | + 'paymentTypes' => config('constants.payment_types'), |
| 109 | + 'countries' => config('constants.countries'), |
| 110 | + ]) }}" |
| 111 | + ></project-stage-component> |
| 112 | + |
| 113 | + <button class="btn btn-secondary float-right my-5" type="button" id="project_new_stage" v-show="!newStage" v-on:click="newStage = !newStage">Add new stage</button> |
| 114 | +</div> |
| 115 | +@endsection |
0 commit comments