Permalink
Browse files

Rework estimate listing and data model

Add field for statement of work. Take changelog-style presentation of
dates out of list view because it answers questions that aren't being
asked.
  • Loading branch information...
lovett committed Jan 27, 2019
1 parent a999936 commit 7cdc7991e4da688fe742819f8128290b6e7be193
@@ -96,7 +96,7 @@ public static function listing(Builder $builder)
$builder->selectRaw('clients.name as clientName');
$builder->selectRaw('clients.id as clientId');
$builder->orderByRaw('LOWER(estimates.name) ASC');
$builder->orderByRaw('created_at DESC');
return $builder;
}
@@ -11,15 +11,36 @@ class CurrencyHelper
/**
* Format a monetary value with cents
*
* @param float $value The value to format.
* @param float|null $value The value to format.
*
* @return string
*/
public static function money(float $value)
public static function money(?float $value)
{
if ($value === null) {
return '';
}
return money_format('%.2n', $value);
}
/**
* Format a monetary value without cents
*
* @param float|null $value The value to format.
*
* @return string
*/
public static function dollars(?float $value)
{
if ($value === null) {
return '';
}
return money_format('%.0n', $value);
}
/**
* Calculate an hourly rate
*
@@ -71,7 +71,7 @@ public static function minutesToHours(int $minutes, int $precision = 2)
*
* @return string
*/
public static function readableShortDate(Carbon $value = null)
public static function readableShortDate(?Carbon $value = null)
{
if ($value === null) {
return '';
@@ -120,7 +120,7 @@ public static function shiftTimezone(Carbon $value, string $timezone = null)
*
* @return string
*/
public static function longDate(Carbon $value = null)
public static function longDate(?Carbon $value = null)
{
if ($value === null) {
return '';
@@ -136,7 +136,7 @@ public static function longDate(Carbon $value = null)
*
* @return string
*/
public static function time(Carbon $value = null)
public static function time(?Carbon $value = null)
{
if ($value === null) {
return '';
@@ -181,8 +181,12 @@ public static function roundToNearestMultiple(int $value, int $multiple)
*
* @return string
*/
public static function daysAgo(Carbon $value = null)
public static function daysAgo(?Carbon $value = null)
{
if ($value === null) {
return '';
}
return self::shiftTimezone($value)->diffForHumans();
}
}
@@ -40,6 +40,7 @@ public function rules()
'fee' => 'nullable|numeric',
'hours' => 'nullable|numeric',
'summary' => 'nullable',
'statement_of_work' => 'nullable',
];
}
@@ -72,6 +72,7 @@ function (Blueprint $table) {
$table->integer('fee')->nullable();
$table->integer('hours')->unsigned()->nullable();
$table->text('summary')->nullable();
$table->text('statement_of_work')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreign('client_id')->references('id')->on('clients');
@@ -115,7 +116,7 @@ function (Blueprint $table) {
function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->integer('estimatedDuration')->unsigned();
$table->integer('estimatedDuration')->unsigned()->default(0);
$table->integer('project_id')->unsigned();
$table->integer('invoice_id')->nullable()->unsigned();
$table->dateTime('start')->nullable();
Oops, something went wrong.

0 comments on commit 7cdc799

Please sign in to comment.