Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added address, city, state and country to importer and city to bulk editor #8250

Merged
merged 4 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ public function postBulkEditSave(Request $request)
if ($request->filled('department_id')) {
$update_array['department_id'] = $request->input('department_id');
}
if ($request->filled('city')) {
$update_array['city'] = $request->input('city');
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also have Address, State and Country? Or would that make this too wide?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specifically chose not to do that there because I fear people will get that confused with location. It would we weird to bulk edit a bunch of users with an identical home address, wouldn't it?

if ($request->filled('company_id')) {
$update_array['company_id'] = $request->input('company_id');
}
Expand Down
4 changes: 4 additions & 0 deletions app/Importer/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ abstract class Importer
'full_name' => 'full name',
'email' => 'email',
'username' => 'username',
'address' => 'address',
'city' => 'city',
'state' => 'state',
'country' => 'country',
'jobtitle' => 'job title',
'employee_num' => 'employee number',
'phone_number' => 'phone number',
Expand Down
4 changes: 4 additions & 0 deletions app/Importer/UserImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function createUserIfNotExists(array $row)
$this->item['email'] = $this->findCsvMatch($row, 'email');
$this->item['phone'] = $this->findCsvMatch($row, 'phone_number');
$this->item['jobtitle'] = $this->findCsvMatch($row, 'jobtitle');
$this->item['address'] = $this->findCsvMatch($row, 'address');
$this->item['city'] = $this->findCsvMatch($row, 'city');
$this->item['state'] = $this->findCsvMatch($row, 'state');
$this->item['country'] = $this->findCsvMatch($row, 'country');
$this->item['activated'] = ($this->fetchHumanBoolean($this->findCsvMatch($row, 'activated')) == 1) ? '1' : 0;

\Log::debug('UserImporter.php Activated: '.$this->findCsvMatch($row, 'activated'));
Expand Down
6 changes: 5 additions & 1 deletion app/Importer/import_mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| licensed to email | license_email | License |
| licensed to name | license_name | License |
| maintained | maintained | License |
| manager_id | | User |
| manager_id | | User |
| manufacturer | manufacturer | All |
| model name | asset_model | Asset |
| model number | model_number | Asset |
Expand All @@ -34,4 +34,8 @@
| User Related Fields | assigned_to | Asset |
| name | | |
| username | | |
| address | address | User |
| city | city | User |
| state | state | User |
| country | country | User |

2 changes: 1 addition & 1 deletion public/js/build/all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/build/vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/build/vue.js.map

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions public/js/dist/all.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/build/vue.js": "/js/build/vue.js?id=461ae9803574a5a52d43",
"/js/build/vue.js": "/js/build/vue.js?id=aff26ce7202625817ca1",
"/css/AdminLTE.css": "/css/AdminLTE.css?id=56b8066cfbc70df10545",
"/css/app.css": "/css/app.css?id=407edb63cc6b6dc62405",
"/css/overrides.css": "/css/overrides.css?id=d1fe6296eb548247a5ad",
Expand All @@ -18,7 +18,7 @@
"/css/skins/skin-blue-dark.css": "/css/skins/skin-blue-dark.css?id=d25c77d9c6f4cfe2efd4",
"/css/skins/skin-orange-dark.css": "/css/skins/skin-orange-dark.css?id=abc219c1fed59cecb860",
"/css/skins/skin-orange.css": "/css/skins/skin-orange.css?id=59664dbd286988d2a438",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=1760ae00d44238e44172",
"/js/build/vue.js.map": "/js/build/vue.js.map?id=41a870ef3b9b5c6688ca",
"/css/AdminLTE.css.map": "/css/AdminLTE.css.map?id=5a2d6f3c59191ce716e2",
"/css/app.css.map": "/css/app.css.map?id=96b5c985e860716e6a16",
"/css/overrides.css.map": "/css/overrides.css.map?id=f3e3cf42859eb4a28a7b",
Expand All @@ -38,7 +38,7 @@
"/css/skins/skin-orange-dark.css.map": "/css/skins/skin-orange-dark.css.map?id=68b998638217fd08ef29",
"/css/skins/skin-orange.css.map": "/css/skins/skin-orange.css.map?id=f90fda3cc0a48c048a9e",
"/css/dist/all.css": "/css/dist/all.css?id=0491555899142b86167d",
"/js/dist/all.js": "/js/dist/all.js?id=4513ccdd4533b52922a8",
"/js/dist/all.js": "/js/dist/all.js?id=5ac062af7b26fb838213",
"/css/build/all.css": "/css/build/all.css?id=0491555899142b86167d",
"/js/build/all.js": "/js/build/all.js?id=4513ccdd4533b52922a8"
"/js/build/all.js": "/js/build/all.js?id=5ac062af7b26fb838213"
}
4 changes: 4 additions & 0 deletions resources/assets/js/components/importer/importer-file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@
{id: 'manager_first_name', text: 'Manager First Name' },
{id: 'manager_last_name', text: 'Manager Last Name' },
{id: 'activated', text: 'Activated' },
{id: 'address', text: 'Address' },
{id: 'city', text: 'City' },
{id: 'state', text: 'State' },
{id: 'country', text: 'Country' },

],
customFields: this.customFields,
Expand Down
9 changes: 9 additions & 0 deletions resources/views/users/bulk-edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@
</div>
</div>

<!-- City -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar question as above - is just City enough?

<div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>
<div class="col-md-4">
<input class="form-control" type="text" name="city" id="city" aria-label="city" />
{!! $errors->first('city', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div>
</div>

<!-- activated -->
<div class="form-group">
<div class="col-sm-3 control-label">
Expand Down
22 changes: 21 additions & 1 deletion resources/views/users/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,31 @@
<td class="text-nowrap">{{ trans('admin/users/table.name') }}</td>
<td>{{ $user->present()->fullName() }}</td>
</tr>

<tr>
<td class="text-nowrap">{{ trans('admin/users/table.username') }}</td>
<td>{{ $user->username }}</td>
</tr>
@if (($user->address) || ($user->city) || ($user->state) || ($user->country))
<tr>
<td class="text-nowrap">{{ trans('general.address') }}</td>
<td>
@if ($user->address)
{{ $user->address }} <br>
@endif
@if ($user->city)
{{ $user->city }}
@endif
@if ($user->state)
{{ $user->state }}
@endif
@if ($user->country)
{{ $user->country }}
@endif
</td>
</tr>

@endif
<tr>
<td class="text-nowrap">{{ trans('general.groups') }}</td>
<td>
Expand Down Expand Up @@ -304,7 +324,7 @@
<a href="{{ route('users.edit', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/users/general.edit') }}</a>
</div>
@endcan

@can('create', $user)
<div class="col-md-12" style="padding-top: 5px;">
<a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-primary hidden-print">{{ trans('admin/users/general.clone') }}</a>
Expand Down