Added user field

job_title

Change-Id: I54eaedcdbe797468bc028dcc56115f0993742f2c
Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
smarcet 2020-11-05 15:48:49 -03:00
parent af33b9fece
commit 914972a407
8 changed files with 103 additions and 15 deletions

View File

@ -54,6 +54,7 @@ final class UserValidationRulesFactory
'password' => 'sometimes|string|confirmed|password_policy',
'phone_number' => 'nullable|string',
'company' => 'nullable|string',
'job_title' => 'nullable|string',
// admin fields
'email_verified' => 'nullable|boolean',
'active' => 'nullable|boolean',
@ -87,6 +88,7 @@ final class UserValidationRulesFactory
'password' => 'sometimes|string|confirmed|password_policy',
'phone_number' => 'nullable|string',
'company' => 'nullable|string',
'job_title' => 'nullable|string',
// admin fields
'email_verified' => 'nullable|boolean',
'active' => 'nullable|boolean',

View File

@ -42,6 +42,7 @@ final class PrivateUserSerializer extends BaseUserSerializer
'Email' => 'email:json_string',
'Bio' => 'bio:json_string',
'Company' => 'company:json_string',
'JobTitle' => 'job_title:json_string',
'Gender' => 'gender:json_string',
'SpamType' => 'spam_type:json_string',
'Identifier' => 'identifier:json_string',

View File

@ -126,6 +126,9 @@ final class UserFactory
if(isset($payload['company']))
$user->setCompany(trim($payload['company']));
if(isset($payload['job_title']))
$user->setJobTitle(trim($payload['job_title']));
if(isset($payload['post_code']))
$user->setPostCode(trim($payload['post_code']));

View File

@ -288,6 +288,12 @@ class User extends BaseEntity
*/
private $company;
/**
* @ORM\Column(name="job_title", nullable=true, type="string")
* @var string
*/
private $job_title;
/**
* @ORM\Column(name="phone_number", nullable=true, type="string")
* @var string
@ -1757,4 +1763,21 @@ SQL;
public static function getProfilePicFolder():string{
return self::ProfilePicFolder;
}
/**
* @return string
*/
public function getJobTitle(): ?string
{
return $this->job_title;
}
/**
* @param string $job_title
*/
public function setJobTitle(string $job_title): void
{
$this->job_title = $job_title;
}
}

View File

@ -0,0 +1,49 @@
<?php namespace Database\Migrations;
/**
* Copyright 2020 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema as Schema;
use LaravelDoctrine\Migrations\Schema\Builder;
use LaravelDoctrine\Migrations\Schema\Table;
/**
* Class Version20201105184620
* @package Database\Migrations
*/
class Version20201105184620 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$builder = new Builder($schema);
if($schema->hasTable("users") && !$builder->hasColumn("users","job_title") ) {
$builder->table('users', function (Table $table) {
$table->string('job_title')->setNotnull(false)->setLength(254);
});
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$builder = new Builder($schema);
if($schema->hasTable("users") && $builder->hasColumn("users","job_title") ) {
$builder->table('users', function (Table $table) {
$table->dropColumn('job_title');
});
}
}
}

View File

@ -152,18 +152,23 @@
</select>
</div>
<div class="clearfix"></div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="city">Phone</label>
<input autocomplete="off" class="form-control" type="text" name="phone_number" id="phone_number"
value="{!! $user->phone_number !!}">
</div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="state">Company</label>
<input autocomplete="off" class="form-control" type="text" name="company" id="company"
value="{!! $user->company !!}">
value="{!! $user->company !!}" data-lpignore="true">
</div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="state">Title</label>
<input autocomplete="off" class="form-control" type="text" name="job_title" id="job_title" data-lpignore="true"
value="{!! $user->job_title !!}">
</div>
<div class="clearfix"></div>
<div class="form-group col-xs-10 col-sm-4 col-md-12 col-lg-12">
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="city">Phone</label>
<input autocomplete="off" class="form-control" type="text" name="phone_number" id="phone_number"
value="{!! $user->phone_number !!}" data-lpignore="true">
</div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="language">Language</label>
<select id="language" class="form-control" name="language" value="{!! $user->language !!}" data-lpignore="true" autocomplete="off">
<option value="">--SELECT A LANGUAGE --</option>

View File

@ -17,7 +17,7 @@
@if( $show_pic && !empty($pic))
<div class="row">
<div class="col-md-4">
<img src="{!! $pic !!}" class="img-thumbnail">
<img src="{!! $pic !!}" class="img-circle" id="img-pic" title="Profile pic">
</div>
</div>
@endif
@ -53,7 +53,7 @@
@if( $show_pic && !empty($pic))
<div class="row">
<div class="col-md-4">
<img src="{!! $pic !!}" class="img-thumbnail">
<img src="{!! $pic !!}" class="img-circle" id="img-pic" title="Profile pic">
</div>
</div>
@endif

View File

@ -185,18 +185,23 @@
</select>
</div>
<div class="clearfix"></div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="state">Company</label>
<input autocomplete="off" class="form-control" type="text" name="company" id="company"
value="{!! $user->company !!}" data-lpignore="true">
</div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="state">Title</label>
<input autocomplete="off" class="form-control" type="text" name="job_title" id="job_title"
value="{!! $user->job_title !!}" data-lpignore="true">
</div>
<div class="clearfix"></div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="city">Phone</label>
<input autocomplete="off" class="form-control" type="text" name="phone_number" id="phone_number"
value="{!! $user->phone_number !!}" data-lpignore="true">
</div>
<div class="form-group col-xs-10 col-sm-4 col-md-6 col-lg-6">
<label for="state">Company</label>
<input autocomplete="off" class="form-control" type="text" name="company" id="company"
value="{!! $user->company !!}" data-lpignore="true">
</div>
<div class="clearfix"></div>
<div class="form-group col-xs-10 col-sm-4 col-md-12 col-lg-12">
<label for="language">Language</label>
<select id="language" class="form-control" name="language"
value="{!! $user->language !!}">