Skip to content

Commit

Permalink
Merge pull request #8250 from snipe/features/adds_addr_city_state_to_…
Browse files Browse the repository at this point in the history
…importer

Added address, city, state and country to importer and city to bulk editor
  • Loading branch information
snipe authored Jul 22, 2020
2 parents 2fa17ac + eed41e4 commit e955c98
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 36 deletions.
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');
}

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 -->
<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

0 comments on commit e955c98

Please sign in to comment.