This commit is contained in:
kroutony 2022-05-04 10:41:51 +08:00
parent e85df8de0a
commit bc09cf9f24
3 changed files with 100 additions and 140 deletions

View File

@ -14,7 +14,7 @@ private function createOrEdit(Project $project)
{
$statuses = __('enums.project_status');
$clients = Client::all()->pluck('name', 'id');
$projects = collect(['' => '無'])->merge(Project::all()->pluck('title', 'id'));
$projects = collect(['' => '無'])->union(Project::all()->pluck('title', 'id'));
return view('project.edit', ['project' => $project, 'projectStatuses' => $statuses, 'clients' => $clients, 'projects' => $projects]);
}
@ -34,8 +34,7 @@ public function index(Request $request)
$builder->where('client_id', $clientId);
}
$projects = $builder->get();
$statuses[''] = '所有狀態';
$statuses += __('enums.project_status');
$statuses = collect(['' => '所有狀態'])->union(__('enums.project_status'));
return view('project.index', ['projects' => $projects, 'statuses' => $statuses]);
}

View File

@ -2,36 +2,39 @@
@section('content')
<div class="container">
<div class="row">
<div class="row justify-content">
<div class="col">
<strong>名稱</strong>
</div>
<div class="col">
{{ $client->name }}
</div>
</div>
<div class="row">
<div class="col">
<strong>專案</strong>
<a href="{{ route('adm.project.index', ['client_id' => $client->id]) }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</div>
<div class="col">
<table class="table table-striped">
<thead>
<table class="table table-bordered table-hover table-sm table-striped">
<tbody>
<tr>
<th>名稱</th>
<th>金額</th>
<td>{{ $client->name }}</td>
</tr>
</thead>
<tbody>
@foreach($client->projects as $project)
<tr>
<td>{{ $project->title }}</td>
<td>{{ $project->price }}</td>
<th>專案
<a href="{{ route('adm.project.index', ['client_id' => $client->id]) }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</th>
<td>
<table class="table table-striped">
<thead>
<tr>
<th>名稱</th>
<th>金額</th>
</tr>
</thead>
<tbody>
@foreach($client->projects as $project)
<tr>
<td>{{ $project->title }}</td>
<td>{{ $project->price }}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>

View File

@ -1,120 +1,78 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col">
<div class="row">
<div class="col">
<strong>名稱</strong>
</div>
<div class="col">
{{ $project->title }}
</div>
</div>
<div class="row">
<div class="col">
<strong>狀態</strong>
</div>
<div class="col">
{{ __('enums.project_status.' . $project->status) }}
</div>
</div>
<div class="row">
<div class="col">
<strong>客戶</strong>
</div>
<div class="col">
{{ $project->client->name }}
</div>
</div>
<div class="row">
<div class="col">
<strong>描述</strong>
</div>
<div class="col">
{!! nl2br($project->description) !!}
</div>
</div>
<div class="row">
<div class="col">
<strong>起始日</strong>
</div>
<div class="col">
{{ $project->begin_at }}
</div>
</div>
<div class="row">
<div class="col">
<strong>結束日</strong>
</div>
<div class="col">
{{ $project->end_at }}
</div>
</div>
<div class="row">
<div class="col">
<strong>金額</strong>
</div>
<div class="col">
{{ $project->price }}
</div>
</div>
<div class="row">
<div class="col">
<strong>建立日期</strong>
</div>
<div class="col">
{{ $project->created_at }}
</div>
</div>
<div class="row">
<div class="col">
<strong>更新日期</strong>
</div>
<div class="col">
{{ $project->updated_at }}
</div>
</div>
<div class="row">
<div class="col">
<strong>未收款項</strong>
</div>
<div class="col">
@if($project->unpaid_amount) {{ $project->unpaid_amount }} @endif
</div>
</div>
<div class="row">
<div class="col">
<strong>已收款項</strong>
<a href="{{ route('adm.payment.create', ['project_id' => $project->id]) }}" class="btn btn-sm btn-outline-success"><i class="bi bi-plus"></i></a>
</div>
<div class="col">
<table class="table">
<thead>
<tr>
<th>類型</th>
<th>金額</th>
<th>日期</th>
</tr>
</thead>
<tbody>
@foreach($project->payments as $payment)
<tr>
<td>{{ __('enums.payment_type.' . $payment->type) }}</td>
<td>{{ $payment->amount }}</td>
<td>{{ $payment->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
<ul>
</ul>
</div>
<div class="container">
<div class="row justify-content-center">
<div class="col">
<table class="table table-bordered table-hover table-sm table-striped">
<tbody>
<tr>
<th>名稱</th>
<td>{{ $project->title }}</td>
</tr>
<tr>
<th>狀態</th>
<td>{{ __('enums.project_status.' . $project->status) }}</td>
</tr>
<tr>
<th>客戶</th>
<td>{{ $project->client->name }}</td>
</tr>
<tr>
<th>描述</th>
<td>{!! nl2br($project->description) !!}</td>
</tr>
<tr>
<th>起始日</th>
<td>{{ $project->begin_at }}</td>
</tr>
<tr>
<th>結束日</th>
<td>{{ $project->end_at }}</td>
</tr>
<tr>
<th>金額</th>
<td>{{ $project->price }}</td>
</tr>
<tr>
<th>建立日期</th>
<td>{{ $project->created_at }}</td>
</tr>
<tr>
<th>更新日期</th>
<td>{{ $project->updated_at }}</td>
</tr>
<tr>
<th>未收款項</th>
<td>@if($project->unpaid_amount) {{ $project->unpaid_amount }} @endif</td>
</tr>
<tr>
<th>已收款項 <a href="{{ route('adm.payment.create', ['project_id' => $project->id]) }}"
class="btn btn-sm btn-outline-success"><i class="bi bi-plus"></i></a></th>
<td>
<table class="table">
<thead>
<tr>
<th>類型</th>
<th>金額</th>
<th>日期</th>
</tr>
</thead>
<tbody>
@foreach($project->payments as $payment)
<tr>
<td>{{ __('enums.payment_type.' . $payment->type) }}</td>
<td>{{ $payment->amount }}</td>
<td>{{ $payment->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection