From 5ffd2b4678f6cef595b1437180e86c220c5dfb4b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 26 Oct 2020 08:05:33 +1100 Subject: [PATCH] Add sort order to task status --- app/Transformers/TaskStatusTransformer.php | 1 + app/Utils/HtmlEngine.php | 16 ++++++++-------- .../2020_10_22_204900_company_table_fields.php | 4 ++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/Transformers/TaskStatusTransformer.php b/app/Transformers/TaskStatusTransformer.php index f96f33a4fa..f312559515 100644 --- a/app/Transformers/TaskStatusTransformer.php +++ b/app/Transformers/TaskStatusTransformer.php @@ -23,6 +23,7 @@ class TaskStatusTransformer extends EntityTransformer return [ 'id' => (string) $this->encodePrimaryKey($task_status->id), 'name' => (string) $task_status->name, + 'sort_order' => (int) $task_status->sort_order, 'is_deleted' => (bool) $task_status->is_deleted, 'created_at' => (int) $task_status->created_at, 'updated_at' => (int) $task_status->updated_at, diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 94a36c88b9..401a173d55 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -210,10 +210,10 @@ class HtmlEngine // $data['$details'] = ; $data['$invoice_no'] = &$data['$number']; $data['$invoice.invoice_no'] = &$data['$number']; - $data['$client1'] = ['value' => $this->client->custom_value1 ?: ' ', 'label' => $this->makeCustomField('client1')]; - $data['$client2'] = ['value' => $this->client->custom_value2 ?: ' ', 'label' => $this->makeCustomField('client2')]; - $data['$client3'] = ['value' => $this->client->custom_value3 ?: ' ', 'label' => $this->makeCustomField('client3')]; - $data['$client4'] = ['value' => $this->client->custom_value4 ?: ' ', 'label' => $this->makeCustomField('client4')]; + $data['$client1'] = ['value' => $this->formatCustomFieldValue('client1', $this->client->custom_value1) ?: ' ', 'label' => $this->makeCustomField('client1')]; + $data['$client2'] = ['value' => $this->formatCustomFieldValue('client2', $this->client->custom_value2) ?: ' ', 'label' => $this->makeCustomField('client2')]; + $data['$client3'] = ['value' => $this->formatCustomFieldValue('client3', $this->client->custom_value3) ?: ' ', 'label' => $this->makeCustomField('client3')]; + $data['$client4'] = ['value' => $this->formatCustomFieldValue('client4', $this->client->custom_value4) ?: ' ', 'label' => $this->makeCustomField('client4')]; $data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')]; $data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')]; $data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; @@ -276,10 +276,10 @@ class HtmlEngine $data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')]; $data['$company_logo'] = &$data['$company.logo']; - $data['$company1'] = ['value' => $this->settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; - $data['$company2'] = ['value' => $this->settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')]; - $data['$company3'] = ['value' => $this->settings->custom_value3 ?: ' ', 'label' => $this->makeCustomField('company3')]; - $data['$company4'] = ['value' => $this->settings->custom_value4 ?: ' ', 'label' => $this->makeCustomField('company4')]; + $data['$company1'] = ['value' => $this->formatCustomFieldValue('company1', $this->settings->custom_value1) ?: ' ', 'label' => $this->makeCustomField('company1')]; + $data['$company2'] = ['value' => $this->formatCustomFieldValue('company2', $this->settings->custom_value2) ?: ' ', 'label' => $this->makeCustomField('company2')]; + $data['$company3'] = ['value' => $this->formatCustomFieldValue('company3', $this->settings->custom_value3) ?: ' ', 'label' => $this->makeCustomField('company3')]; + $data['$company4'] = ['value' => $this->formatCustomFieldValue('company4', $this->settings->custom_value4) ?: ' ', 'label' => $this->makeCustomField('company4')]; $data['$custom_surcharge1'] = ['value' => $this->entity->custom_surcharge1 ?: ' ', 'label' => $this->makeCustomField('custom_surcharge1')]; $data['$custom_surcharge2'] = ['value' => $this->entity->custom_surcharge2 ?: ' ', 'label' => $this->makeCustomField('custom_surcharge2')]; diff --git a/database/migrations/2020_10_22_204900_company_table_fields.php b/database/migrations/2020_10_22_204900_company_table_fields.php index 14d8bd57fa..9c43fb278a 100644 --- a/database/migrations/2020_10_22_204900_company_table_fields.php +++ b/database/migrations/2020_10_22_204900_company_table_fields.php @@ -16,6 +16,10 @@ class CompanyTableFields extends Migration Schema::table('companies', function(Blueprint $table){ $table->boolean('invoice_task_timelog')->default(true); }); + + Schema::table('task_statuses', function(Blueprint $table){ + $table->unsignedInteger('sort_order')->default(0); + }); } /**