Merge pull request #15418 from snipe/added_multiple_for_custom_report

Fixed #15416 - Added multiple selects for custom report
This commit is contained in:
snipe 2024-08-29 18:55:11 +01:00 committed by GitHub
commit 6fd24c7e14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 85 additions and 38 deletions

View file

@ -1561,7 +1561,7 @@ class Asset extends Depreciable
$leftJoin->on('assets_dept_users.id', '=', 'assets.assigned_to') $leftJoin->on('assets_dept_users.id', '=', 'assets.assigned_to')
->where('assets.assigned_type', '=', User::class); ->where('assets.assigned_type', '=', User::class);
})->where(function ($query) use ($search) { })->where(function ($query) use ($search) {
$query->where('assets_dept_users.department_id', '=', $search); $query->whereIn('assets_dept_users.department_id', $search);
})->withTrashed()->whereNull('assets.deleted_at'); //workaround for laravel bug })->withTrashed()->whereNull('assets.deleted_at'); //workaround for laravel bug
} }
@ -1811,7 +1811,7 @@ class Asset extends Depreciable
public function scopeInCategory($query, $category_id) public function scopeInCategory($query, $category_id)
{ {
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id') return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id); ->join('categories', 'category_models.category_id', '=', 'categories.id')->whereIn('category_models.category_id', $category_id);
} }
/** /**
@ -1825,7 +1825,7 @@ class Asset extends Depreciable
public function scopeByManufacturer($query, $manufacturer_id) public function scopeByManufacturer($query, $manufacturer_id)
{ {
return $query->join('models', 'assets.model_id', '=', 'models.id') return $query->join('models', 'assets.model_id', '=', 'models.id')
->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->where('models.manufacturer_id', '=', $manufacturer_id); ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', $manufacturer_id);
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,8 +2,8 @@
"/js/build/app.js": "/js/build/app.js?id=5e9ac5c1a7e089f056fb1dba566193a6", "/js/build/app.js": "/js/build/app.js?id=5e9ac5c1a7e089f056fb1dba566193a6",
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=f0b08873a06bb54daeee176a9459f4a9", "/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=f0b08873a06bb54daeee176a9459f4a9",
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=f4397c717b99fce41a633ca6edd5d1f4", "/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=f4397c717b99fce41a633ca6edd5d1f4",
"/css/build/overrides.css": "/css/build/overrides.css?id=9265dbc8adc38d13abec7f8ff0374dce", "/css/build/overrides.css": "/css/build/overrides.css?id=ebd921b0b5dca37487551bcc7dc934c5",
"/css/build/app.css": "/css/build/app.css?id=76584ef562c22532ffa84748f18e3a65", "/css/build/app.css": "/css/build/app.css?id=2b1b6164d02342fcd4cd303fef52e895",
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=4ea0068716c1bb2434d87a16d51b98c9", "/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=4ea0068716c1bb2434d87a16d51b98c9",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=7b315b9612b8fde8f9c5b0ddb6bba690", "/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=393aaa7b368b0670fc42434c8cca7dc7", "/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=393aaa7b368b0670fc42434c8cca7dc7",
@ -19,7 +19,7 @@
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=f677207c6cf9678eb539abecb408c374", "/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=f677207c6cf9678eb539abecb408c374",
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=0640e45bad692dcf62873c6e85904899", "/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=0640e45bad692dcf62873c6e85904899",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb", "/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb",
"/css/dist/all.css": "/css/dist/all.css?id=0978d9f0ba8d47527c248074b757b03d", "/css/dist/all.css": "/css/dist/all.css?id=c1cd73524bd82ddb8a4d7e8d1a504506",
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde", "/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",

View file

@ -500,13 +500,27 @@ body {
.select2-selection--multiple { .select2-selection--multiple {
border-color: #d2d6de !important; border-color: #d2d6de !important;
height: 34px; overflow-y: auto;
} }
.select2-selection__choice { .select2-selection__choice {
border-radius: 0px !important; border-radius: 0px !important;
} }
.select2-search select2-search--inline {
height: 35px !important;
float: left;
margin: 0;
}
.select2-results__option {
padding: 5px;
user-select: none;
-webkit-user-select: none;
margin: 0px;
}
img.navbar-brand-img, .navbar-brand>img { img.navbar-brand-img, .navbar-brand>img {
float: left; float: left;
@ -514,8 +528,8 @@ img.navbar-brand-img, .navbar-brand>img {
max-height: 50px; max-height: 50px;
} }
.input-daterange { .input-daterange, .input-daterange input:first-child, .input-daterange input:last-child {
border-radius: 0px; border-radius: 0px !important;
} }
.btn.bg-maroon, .btn.bg-purple{ .btn.bg-maroon, .btn.bg-purple{

View file

@ -2,7 +2,7 @@
return [ return [
'select_language' => 'Select a language', 'select_language' => 'Select a Language',
'languages' => [ 'languages' => [
'en-US'=> 'English, US', 'en-US'=> 'English, US',
'en-GB'=> 'English, UK', 'en-GB'=> 'English, UK',
@ -68,7 +68,7 @@ return [
'zu-ZA'=> 'Zulu', 'zu-ZA'=> 'Zulu',
], ],
'select_country' => 'Select a country', 'select_country' => 'Select a Country',
'countries' => [ 'countries' => [
'AC'=>'Ascension Island', 'AC'=>'Ascension Island',

View file

@ -11,7 +11,7 @@ Form::macro('locales', function ($name = 'locale', $selected = null, $class = nu
$idclause = (!is_null($id)) ? $id : ''; $idclause = (!is_null($id)) ? $id : '';
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:100%"'.$idclause.' aria-label="'.$name.'" data-placeholder="'.trans('localizations.select_language').'">'; $select = '<select name="'.$name.'" class="'.$class.'" style="width:100%"'.$idclause.' aria-label="'.$name.'" data-placeholder="'.trans('localizations.select_language').'">';
$select .= '<option value="" role="option">'.trans('localizations.select_language').'</option>'; $select .= '<option value="" role="option">'.trans('localizations.select_language').'</option>';
// Pull the autoglossonym array from the localizations translation file // Pull the autoglossonym array from the localizations translation file

View file

@ -9,8 +9,6 @@
<option value="{{ $category_id }}" selected="selected" role="option" aria-selected="true" role="option"> <option value="{{ $category_id }}" selected="selected" role="option" aria-selected="true" role="option">
{{ (\App\Models\Category::find($category_id)) ? \App\Models\Category::find($category_id)->name : '' }} {{ (\App\Models\Category::find($category_id)) ? \App\Models\Category::find($category_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_category') }}</option>
@endif @endif
</select> </select>

View file

@ -10,7 +10,7 @@
{{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }} {{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
</option> </option>
@else @else
<option value="" role="option">{{ trans('general.select_company') }}</option> {!! (!isset($multiple) || ($multiple=='false')) ? '<option value="" role="option">'.trans('general.select_company').'</option>' : '' !!}
@endif @endif
</select> </select>
</div> </div>
@ -20,14 +20,14 @@
<!-- full company support is enabled or this user is a superadmin --> <!-- full company support is enabled or this user is a superadmin -->
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"> <div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}">
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-6"> <div class="col-md-7">
<select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}" style="width: 100%" id="company_select"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}> <select class="js-data-ajax" data-endpoint="companies" data-placeholder="{{ trans('general.select_company') }}" name="{{ $fieldname }}" style="width: 100%" id="company_select"{{ (isset($multiple) && ($multiple=='true')) ? " multiple='multiple'" : '' }}>
@if ($company_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : '')) @if ($company_id = old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $company_id }}" selected="selected"> <option value="{{ $company_id }}" selected="selected">
{{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }} {{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }}
</option> </option>
@else @else
<option value="">{{ trans('general.select_company') }}</option> {!! (!isset($multiple) || ($multiple=='false')) ? '<option value="" role="option">'.trans('general.select_company').'</option>' : '' !!}
@endif @endif
</select> </select>
</div> </div>

View file

@ -8,8 +8,6 @@
<option value="{{ $department_id }}" selected="selected" role="option" aria-selected="true" role="option"> <option value="{{ $department_id }}" selected="selected" role="option" aria-selected="true" role="option">
{{ (\App\Models\Department::find($department_id)) ? \App\Models\Department::find($department_id)->name : '' }} {{ (\App\Models\Department::find($department_id)) ? \App\Models\Department::find($department_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_department') }}</option>
@endif @endif
</select> </select>
</div> </div>

View file

@ -8,8 +8,6 @@
<option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option"> <option value="{{ $location_id }}" selected="selected" role="option" aria-selected="true" role="option">
{{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }} {{ (\App\Models\Location::find($location_id)) ? \App\Models\Location::find($location_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_location') }}</option>
@endif @endif
</select> </select>
</div> </div>

View file

@ -10,7 +10,7 @@
{{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }} {{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }}
</option> </option>
@else @else
<option value="" role="option">{{ trans('general.select_manufacturer') }}</option> {!! (!isset($multiple) || ($multiple=='false')) ? '<option value="" role="option">'.trans('general.select_manufacturer').'</option>' : '' !!}
@endif @endif
</select> </select>

View file

@ -9,8 +9,6 @@
<option value="{{ $model_id }}" selected="selected"> <option value="{{ $model_id }}" selected="selected">
{{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }} {{ (\App\Models\AssetModel::find($model_id)) ? \App\Models\AssetModel::find($model_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_model') }}</option>
@endif @endif
</select> </select>

View file

@ -9,8 +9,6 @@
<option value="{{ $status_id }}" selected="selected" role="option" aria-selected="true" role="option"> <option value="{{ $status_id }}" selected="selected" role="option" aria-selected="true" role="option">
{{ (\App\Models\Statuslabel::find($status_id)) ? \App\Models\Statuslabel::find($status_id)->name : '' }} {{ (\App\Models\Statuslabel::find($status_id)) ? \App\Models\Statuslabel::find($status_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_status') }}</option>
@endif @endif
</select> </select>

View file

@ -8,8 +8,6 @@
<option value="{{ $supplier_id }}" selected="selected" role="option" aria-selected="true" role="option"> <option value="{{ $supplier_id }}" selected="selected" role="option" aria-selected="true" role="option">
{{ (\App\Models\Supplier::find($supplier_id)) ? \App\Models\Supplier::find($supplier_id)->name : '' }} {{ (\App\Models\Supplier::find($supplier_id)) ? \App\Models\Supplier::find($supplier_id)->name : '' }}
</option> </option>
@else
<option value="" role="option">{{ trans('general.select_supplier') }}</option>
@endif @endif
</select> </select>
</div> </div>

View file

@ -278,15 +278,60 @@
<br> <br>
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'),'multiple' => 'true', 'fieldname' => 'by_company_id[]', 'hide_new' => 'true']) @include ('partials.forms.edit.company-select', [
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'multiple' => 'true', 'fieldname' => 'by_location_id[]', 'hide_new' => 'true']) 'translated_name' => trans('general.company'),
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'multiple' => 'true', 'fieldname' => 'by_rtd_location_id[]', 'hide_new' => 'true']) 'fieldname' =>
@include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'by_dept_id', 'hide_new' => 'true']) 'by_company_id[]',
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'by_supplier_id[]', 'multiple' => 'true', 'hide_new' => 'true']) 'multiple' => 'true',
@include ('partials.forms.edit.model-select', ['translated_name' => trans('general.asset_model'), 'fieldname' => 'by_model_id[]', 'multiple' => 'true', 'hide_new' => 'true']) 'hide_new' => 'true'
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'by_manufacturer_id', 'hide_new' => 'true']) ])
@include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'by_category_id', 'hide_new' => 'true', 'category_type' => 'asset']) @include ('partials.forms.edit.location-select', [
@include ('partials.forms.edit.status-select', ['translated_name' => trans('admin/hardware/form.status'), 'fieldname' => 'by_status_id[]', 'multiple' => 'true', 'hide_new' => 'true']) 'translated_name' => trans('general.location'),
'fieldname' => 'by_location_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.location-select', [
'translated_name' => trans('admin/hardware/form.default_location'),
'fieldname' => 'by_rtd_location_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.department-select',[
'translated_name' => trans('general.department'),
'fieldname' => 'by_dept_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.supplier-select', [
'translated_name' => trans('general.supplier'),
'fieldname' => 'by_supplier_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.model-select', [
'translated_name' => trans('general.asset_model'),
'fieldname' => 'by_model_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.manufacturer-select', [
'translated_name' => trans('general.manufacturer'),
'fieldname' => 'by_manufacturer_id[]',
'multiple' => 'true',
'hide_new' => 'true'
])
@include ('partials.forms.edit.category-select', [
'translated_name' => trans('general.category'),
'fieldname' => 'by_category_id[]',
'multiple' => 'true',
'hide_new' => 'true', 'category_type' => 'asset'
])
@include ('partials.forms.edit.status-select', [
'translated_name' => trans('admin/hardware/form.status'),
'fieldname' => 'by_status_id[]',
'multiple' => 'true',
'hide_new' => 'true'])
<!-- Order Number --> <!-- Order Number -->
<div class="form-group"> <div class="form-group">

View file

@ -307,7 +307,7 @@
<!-- language --> <!-- language -->
<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}">
<label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label> <label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label>
<div class="col-md-9"> <div class="col-md-6">
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!} {!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}
{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!} {!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
</div> </div>