Permalink
Browse files

Rework estimate statuses

Drop the dedicated field for estimate close date. Use "draft" as the
default status, and require a value. Further tracking of status
changes over time isn't otherwise worthwhile.
  • Loading branch information...
lovett committed Jan 10, 2019
1 parent b265654 commit 2d53f5c66cd447736e4bb2a368a4e3bc4331c54d
@@ -24,7 +24,7 @@ class Estimate extends Model
* @var array
*/
public $statuses = [
null => '',
'draft' => 'Draft',
'waiting' => 'Waiting',
'accepted' => 'Accepted',
'declined' => 'Declined',
@@ -49,7 +49,6 @@ class Estimate extends Model
protected $fillable = [
'name',
'submitted',
'closed',
'recipient',
'client_id',
'fee',
@@ -71,7 +70,6 @@ class Estimate extends Model
* @var array
*/
protected $dates = [
'closed',
'created_at',
'deleted_at',
'submitted',
@@ -66,12 +66,11 @@ function (Blueprint $table) {
$table->increments('id');
$table->string('name', 100);
$table->date('submitted')->nullable();
$table->date('closed')->nullable();
$table->string('status', 50)->nullable();
$table->string('status', 50);
$table->string('recipient', 100)->nullable();
$table->integer('client_id')->unsigned()->nullable();
$table->integer('fee')->nullable();
$table->integer('hours')->unsigned()->default(0);
$table->integer('hours')->unsigned()->nullable();
$table->text('summary')->nullable();
$table->timestamps();
$table->softDeletes();
@@ -17,8 +17,6 @@

@include('partials.formgroup-date', ['name' => 'submitted', 'label' => 'Submission Date', 'pickable' => ['month', 'day', 'year']])

@include('partials.formgroup-date', ['name' => 'closed', 'label' => 'Close Date', 'pickable' => ['month', 'day', 'year']])

@include('partials.formgroup-menu', ['name' => 'status', 'label' => 'Status', 'items' => $statuses, 'selectedItem' => $model->status])

@include('partials.formgroup-standard', ['name' => 'recipient', 'label' => 'Recipient'])
@@ -25,21 +25,18 @@
{{ CurrencyHelper::money($estimate->fee) }}
</td>
<td>
@if ($estimate->closed)
<p class="mb-0">closed {{ TimeHelper::date($estimate->closed) }}</p>
@if ($estimate->updated_at > $estimate->created_at)
<p class="mb-0">updated {{ TimeHelper::date($estimate->updated_at) }} at {{ TimeHelper::time($estimate->updated_at) }}</p>
@endif

@if ($estimate->submitted)
<p class="mb-0">submitted {{ TimeHelper::date($estimate->submitted) }}</p>
@endif

@if ($estimate->updated_at > $estimate->created_at)
<p class="mb-0">updated {{ TimeHelper::date($estimate->updated_at) }} at {{ TimeHelper::time($estimate->updated_at) }}</p>
@endif

<p class="mb-0">created {{ TimeHelper::date($estimate->created_at) }} at {{ TimeHelper::time($estimate->created_at) }}</p>
</td>
<td>
{{ $estimate->recipient }}
{{ $estimate->recipient ?? 'None' }}
</td>
@unless(Route::is('client.show'))
<td>
@@ -48,12 +45,12 @@
{{ $estimate->clientName }}
</a>
@else
none
None
@endif
</td>
@endunless
<td>
{{ $estimate->hours }}
{{ $estimate->hours ?? '' }}
</td>
<td>
{{ $estimate->status }}

0 comments on commit 2d53f5c

Please sign in to comment.