1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-23 19:02:46 +01:00

Rename customer background into notes, delete age, gender fields

This commit is contained in:
FreeScout 2020-11-19 01:15:00 -08:00
parent fcdf2fba0e
commit 4f8063214f
4 changed files with 45 additions and 9 deletions

View File

@ -446,7 +446,7 @@ class Customer extends Model
*
* @var [type]
*/
protected $fillable = ['first_name', 'last_name', 'company', 'job_title', 'address', 'city', 'state', 'zip', 'country', 'photo_url', 'age', 'gender', 'background'];
protected $fillable = ['first_name', 'last_name', 'company', 'job_title', 'address', 'city', 'state', 'zip', 'country', 'photo_url', 'age', 'gender', 'notes'];
/**
* Fields stored as JSON.
@ -920,8 +920,8 @@ class Customer extends Model
unset($data['photo_url']);
}
if (!empty($data['notes']) && empty($data['background'])) {
$data['background'] = $data['notes'];
if (!empty($data['background']) && empty($data['notes'])) {
$data['notes'] = $data['background'];
}
if ($replace_data) {

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('customers', function (Blueprint $table) {
$table->dropColumn('age');
$table->dropColumn('gender');
$table->renameColumn('background', 'notes');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('customers', function (Blueprint $table) {
$table->string('age', 7)->nullable();
$table->unsignedTinyInteger('gender')->nullable();
$table->renameColumn('notes', 'background');
});
}
}

View File

@ -241,13 +241,13 @@
</div>
</div>
<div class="form-group{{ $errors->has('background') ? ' has-error' : '' }}">
<label for="background" class="col-sm-2 control-label">{{ __('Notes') }}</label>
<div class="form-group{{ $errors->has('notes') ? ' has-error' : '' }}">
<label for="notes" class="col-sm-2 control-label">{{ __('Notes') }}</label>
<div class="col-sm-6">
<textarea id="background" class="form-control input-sized-lg" name="background" rows="2">{{ old('background', $customer->background) }}</textarea>
<textarea id="notes" class="form-control input-sized-lg" name="notes" rows="2">{{ old('notes', $customer->notes) }}</textarea>
@include('partials/field_error', ['field'=>'background'])
@include('partials/field_error', ['field'=>'notes'])
</div>
</div>

View File

@ -46,9 +46,9 @@
@if ($customer->address)<div>{{ $customer->address }}</div>@endif
</div>
@endif
@if ($customer->background)
@if ($customer->notes)
<div class="customer-section">
<i>{{ $customer->background }}</i>
<i>{{ $customer->notes }}</i>
</div>
@endif
</div>