A free open source IT asset/license management system
Remove accessory references
Marcus Moore2b56706cee30
diff --git a/app/Http/Controllers/Reports/CustomAccessoryReportController.php b/app/Http/Controllers/Reports/CustomAccessoryReportController.phpdeleted file mode 100644index 542d822caf..0000000000--- a/app/Http/Controllers/Reports/CustomAccessoryReportController.php+++ /dev/null@@ -1,42 +0,0 @@-<?php--namespace App\Http\Controllers\Reports;--use App\Http\Controllers\Controller;-use App\Models\ReportTemplate;-use Illuminate\Http\Request;--class CustomAccessoryReportController extends Controller-{- public function show(Request $request)- {- $this->authorize('reports.view');-- $report_templates = ReportTemplate::where('type', 'accessory')->orderBy('name')->get();-- // The view needs a template to render correctly, even if it is empty...- $template = new ReportTemplate;-- // Set the report's input values in the cases we were redirected back- // with validation errors so the report is populated as expected.- if ($request->old()) {- $template->name = $request->old('name');- $template->options = $request->old();- }-- return view('reports.custom.accessory', [- 'report_templates' => $report_templates,- 'template' => $template,- ]);- }-- public function run()- {- $this->authorize('reports.view');-- ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); // 12000 seconds = 200 minutes-- $this->disableDebugbar();-- }-}diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.phpindex e95fe6a4ec..0226c83122 100644--- a/resources/views/layouts/default.blade.php+++ b/resources/views/layouts/default.blade.php@@ -1851,11 +1851,6 @@{{ trans('general.custom_report') }}</a></li>- <li {{!! (request()->is('reports.custom.accessory') ? ' class="active"' : '') !!}}>- <a href="{{ route('reports.custom.accessory') }}">- Custom Accessory Report- </a>- </li><li {{!! (request()->is('reports.custom.component') ? ' class="active"' : '') !!}}><a href="{{ route('reports.custom.component') }}">Custom Component Reportdiff --git a/resources/views/reports/custom/accessory.blade.php b/resources/views/reports/custom/accessory.blade.phpdeleted file mode 100644index 1f9d316350..0000000000--- a/resources/views/reports/custom/accessory.blade.php+++ /dev/null@@ -1,685 +0,0 @@-@extends('layouts/default')--{{-- Page Title --}}-@section('title')- @if (request()->routeIs('report-templates.edit'))- {{ trans('general.update') }} {{ $template->name }}- @elseif(request()->routeIs('report-templates.show'))- Custom Accessory Report: {{ $template->name }}- @else- Custom Accessory Report- @endif- @parent-@stop--@section('header_right')- @if (request()->routeIs('report-templates.edit'))- <a href="{{ route('report-templates.show', $template) }}" class="btn btn-primary pull-right">- {{ trans('general.back') }}- </a>- @elseif (request()->routeIs('report-templates.show'))- <a href="{{ route('reports/custom') }}" class="btn btn-primary pull-right">- {{ trans('general.back') }}- </a>- @else- <a href="{{ URL::previous() }}" class="btn btn-primary pull-right">- {{ trans('general.back') }}- </a>- @endif-@stop---{{-- Page content --}}-@section('content')-- <div class="row">- <div class="col-md-9">-- <form- method="POST"- action="{{ request()->routeIs('report-templates.edit') ? route('report-templates.update', $template) : route('reports.custom.accessory.run') }}"- accept-charset="UTF-8"- class="form-horizontal"- id="custom-report-form"- >- {{csrf_field()}}-- <!-- Horizontal Form -->- <div class="box box-default">- <div class="box-header with-border">- @if (request()->routeIs('reports.custom.accessory', 'report-templates.show'))- <h2 class="box-title" style="padding-top: 7px;">- {{ trans('general.customize_report') }}- </h2>-- @endif-- @if (request()->routeIs('report-templates.edit'))- <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">- <label- for="name"- class="col-md-2 control-label"- >- {{ trans('admin/reports/general.template_name') }}- </label>- <div class="col-md-5">- <input- class="form-control"- placeholder=""- name="name"- type="text"- id="name"- value="{{ $template->name }}"- required- >- {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @if ($template->created_by == auth()->id())- <div class="col-md-3">- <label class="form-control">- <input type="checkbox" name="is_shared" value="1" @checked($template->is_shared) />- {{ trans('admin/reports/general.share_template') }}- </label>- </div>- @endif- </div>- @endif-- </div><!-- /.box-header -->-- <div class="box-body">-- <div class="col-md-4" id="included_fields_wrapper">-- <label class="form-control">- <input type="checkbox" id="checkAll" checked="checked">- {{ trans('general.select_all') }}- </label>-- <label class="form-control">- <input type="checkbox" name="id" value="1" @checked($template->checkmarkValue('id')) />- {{ trans('general.id') }}- </label>-- <label class="form-control">- <input type="checkbox" name="company" value="1" @checked($template->checkmarkValue('company')) />- {{ trans('general.company') }}- </label>-- <label class="form-control">- <input type="checkbox" name="accessory_name" value="1" @checked($template->checkmarkValue('accessory_name')) />- {{ trans('admin/accessories/general.accessory_name') }}- </label>-- <label class="form-control">- <input type="checkbox" name="manufacturer" value="1" @checked($template->checkmarkValue('manufacturer')) />- {{ trans('general.manufacturer') }}- </label>-- <label class="form-control">- <input type="checkbox" name="model" value="1" @checked($template->checkmarkValue('model_number')) />- {{ trans('general.model_no') }}- </label>-- <label class="form-control">- <input type="checkbox" name="category" value="1" @checked($template->checkmarkValue('category')) />- {{ trans('general.category') }}- </label>-- <label class="form-control">- <input type="checkbox" name="purchase_date" value="1" @checked($template->checkmarkValue('purchase_date')) />- {{ trans('admin/licenses/table.purchase_date') }}- </label>-- <label class="form-control">- <input type="checkbox" name="purchase_cost" value="1" @checked($template->checkmarkValue('purchase_cost')) />- {{ trans('admin/hardware/form.cost') }}- </label>-- <label class="form-control">- <input type="checkbox" name="order" value="1" @checked($template->checkmarkValue('order')) />- {{ trans('admin/hardware/form.order') }}- </label>-- <label class="form-control">- <input type="checkbox" name="quantity" value="1" @checked($template->checkmarkValue('quantity')) />- {{ trans('general.quantity') }}- </label>-- <label class="form-control">- <input type="checkbox" name="supplier" value="1" @checked($template->checkmarkValue('supplier')) />- {{ trans('general.suppliers') }}- </label>-- <label class="form-control">- <input type="checkbox" name="location" value="1" @checked($template->checkmarkValue('location')) />- {{ trans('general.location') }}- </label>-- <label class="form-control" style="margin-left: 25px;">- <input type="checkbox" name="location_address" value="1" @checked($template->checkmarkValue('location_address')) />- {{ trans('general.address') }}- </label>-- <label class="form-control">- <input type="checkbox" name="min_amount" value="1" @checked($template->checkmarkValue('min_amount')) />- {{ trans('general.min_amt') }}- </label>-- <label class="form-control">- <input type="checkbox" name="checkout_date" value="1" @checked($template->checkmarkValue('checkout_date')) />- {{ trans('admin/hardware/table.checkout_date') }}- </label>-- <label class="form-control">- <input type="checkbox" name="created_at" value="1" @checked($template->checkmarkValue('created_at')) />- {{ trans('general.created_at') }}- </label>-- <label class="form-control">- <input type="checkbox" name="updated_at" value="1" @checked($template->checkmarkValue('updated_at')) />- {{ trans('general.updated_at') }}- </label>-- <label class="form-control">- <input type="checkbox" name="deleted_at" value="1" @checked($template->checkmarkValue('deleted_at')) />- {{ trans('general.deleted') }}- </label>-- <label class="form-control">- <input type="checkbox" name="notes" value="1" @checked($template->checkmarkValue('notes')) />- {{ trans('general.notes') }}- </label>-- <!-- User fields -->-- <h2>{{ trans('general.checked_out_to_fields') }}: </h2>-- <label class="form-control">- <input type="checkbox" name="assigned_to" value="1" @checked($template->checkmarkValue('assigned_to')) />- {{ trans('admin/licenses/table.assigned_to') }}- </label>--- <label class="form-control">- <input type="checkbox" name="username" value="1" @checked($template->checkmarkValue('username')) />- {{ trans('admin/users/table.username') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_company" value="1" @checked($template->checkmarkValue('user_company')) />- {{ trans('admin/reports/general.custom_export.user_company') }}- </label>-- <label class="form-control">- <input type="checkbox" name="email" value="1" @checked($template->checkmarkValue('email')) />- {{ trans('admin/users/table.email') }}- </label>-- <label class="form-control">- <input type="checkbox" name="employee_num" value="1" @checked($template->checkmarkValue('employee_num')) />- {{ trans('general.employee_number') }}- </label>-- <label class="form-control">- <input type="checkbox" name="manager" value="1" @checked($template->checkmarkValue('manager')) />- {{ trans('admin/users/table.manager') }}- </label>-- <label class="form-control">- <input type="checkbox" name="department" value="1" @checked($template->checkmarkValue('department')) />- {{ trans('general.department') }}- </label>-- <label class="form-control">- <input type="checkbox" name="title" value="1" @checked($template->checkmarkValue('title')) />- {{ trans('admin/users/table.title') }}- </label>-- <label class="form-control">- <input type="checkbox" name="phone" value="1" @checked($template->checkmarkValue('phone')) />- {{ trans('admin/users/table.phone') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_address" value="1" @checked($template->checkmarkValue('user_address')) />- {{ trans('general.address') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_city" value="1" @checked($template->checkmarkValue('user_city')) />- {{ trans('general.city') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_state" value="1" @checked($template->checkmarkValue('user_state')) />- {{ trans('general.state') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_country" value="1" @checked($template->checkmarkValue('user_country')) />- {{ trans('general.country') }}- </label>-- <label class="form-control">- <input type="checkbox" name="user_zip" value="1" @checked($template->checkmarkValue('user_zip')) />- {{ trans('general.zip') }}- </label>-- <label class="form-control">- <input type="checkbox" name="target_notes" value="1" @checked($template->checkmarkValue('target_notes')) />- {{ trans('admin/reports/general.custom_export.target_notes') }}- </label>-- </div> <!-- /.col-md-4-->-- <div class="col-md-8">-- <p>- {!! trans('general.report_fields_info') !!}- </p>-- <br>-- @include ('partials.forms.edit.company-select', [- 'translated_name' => trans('general.company'),- 'fieldname' =>- 'by_company_id[]',- 'multiple' => 'true',- 'hide_new' => 'true',- 'selected' => $template->selectValues('by_company_id', \App\Models\Company::class),- ])-- @include ('partials.forms.edit.category-select', [- 'translated_name' => trans('general.category'),- 'fieldname' => 'by_category_id[]',- 'multiple' => 'true',- 'hide_new' => 'true',- 'category_type' => 'accessories',- 'selected' => $template->selectValues('by_category_id', \App\Models\Category::class),- ])-- @include ('partials.forms.edit.supplier-select', [- 'translated_name' => trans('general.supplier'),- 'fieldname' => 'by_supplier_id[]',- 'multiple' => 'true',- 'hide_new' => 'true',- 'selected' => $template->selectValues('by_supplier_id', \App\Models\Supplier::class),- ])-- @include ('partials.forms.edit.manufacturer-select', [- 'translated_name' => trans('general.manufacturer'),- 'fieldname' => 'by_manufacturer_id[]',- 'multiple' => 'true',- 'hide_new' => 'true',- 'selected' => $template->selectValues('by_manufacturer_id', \App\Models\Manufacturer::class),- ])-- @include ('partials.forms.edit.location-select', [- 'translated_name' => trans('general.location'),- 'fieldname' => 'by_location_id[]',- 'multiple' => 'true',- 'hide_new' => 'true',- 'selected' => $template->selectValues('by_location_id', \App\Models\Location::class),- ])-- <!-- Name -->- <div class="form-group">- <label for="by_name" class="col-md-3 control-label">{{ trans('general.name') }}</label>- <div class="col-md-7">- <input class="form-control" type="text" name="by_name" value="{{ $template->textValue('by_name', old('by_name')) }}" aria-label="by_name">- </div>- </div>-- <!-- Model Number -->- <div class="form-group">- <label for="by_model_number" class="col-md-3 control-label">{{ trans('general.model_no') }}</label>- <div class="col-md-7">- <input class="form-control" type="text" name="by_model_number" value="{{ $template->textValue('by_model_number', old('by_model_number')) }}" aria-label="by_model_number">- </div>- </div>-- <!-- Order Number -->- <div class="form-group">- <label for="by_order_number" class="col-md-3 control-label">{{ trans('general.order_number') }}</label>- <div class="col-md-7">- <input class="form-control" type="text" name="by_order_number" value="{{ $template->textValue('by_order_number', old('by_order_number')) }}" aria-label="by_order_number">- </div>- </div>-- <!-- Purchase Date -->- <div class="form-group purchase-range{{ ($errors->has('purchase_start') || $errors->has('purchase_end')) ? ' has-error' : '' }}">- <label for="purchase_start" class="col-md-3 control-label">{{ trans('general.purchase_date') }}</label>- <div class="input-daterange input-group col-md-7" id="purchase-range-datepicker">-- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="purchase_start" aria-label="purchase_start" value="{{ $template->textValue('purchase_start', old('purchase_start')) }}">- <span class="input-group-addon"> - </span>- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="purchase_end" aria-label="purchase_end" value="{{ $template->textValue('purchase_end', old('purchase_end')) }}">- </div>-- @if ($errors->has('purchase_start') || $errors->has('purchase_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('purchase_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('purchase_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Unit Cost -->- <div class="form-group unit-range{{ ($errors->has('unit_cost_start') || $errors->has('unit_cost_end')) ? ' has-error' : '' }}">- <label for="unit_cost_start" class="col-md-3 control-label">{{ trans('general.unit_cost') }}</label>- <div class="input-group col-md-7">- <input type="number" min="0" step="0.01" class="form-control" name="unit_cost_start" aria-label="unit_cost_start" value="{{ $template->textValue('unit_cost_start', old('unit_cost_start')) }}">- <span class="input-group-addon"> - </span>- <input type="number" min="0" step="0.01" class="form-control" name="unit_cost_end" aria-label="unit_cost_end" value="{{ $template->textValue('unit_cost_end', old('unit_cost_end')) }}">- </div>-- @if ($errors->has('unit_cost_start') || $errors->has('unit_cost_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('unit_cost_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('unit_cost_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Quantity -->- <div class="form-group quantity-range{{ ($errors->has('quantity_cost_start') || $errors->has('quantity_cost_end')) ? ' has-error' : '' }}">- <label for="quantity_cost_start" class="col-md-3 control-label">{{ trans('general.quantity') }}</label>- <div class="input-group col-md-7">- <input type="number" min="0" class="form-control" name="quantity_cost_start" aria-label="quantity_cost_start" value="{{ $template->textValue('quantity_cost_start', old('quantity_cost_start')) }}">- <span class="input-group-addon"> - </span>- <input type="number" min="0" class="form-control" name="quantity_cost_end" aria-label="quantity_cost_end" value="{{ $template->textValue('quantity_cost_end', old('quantity_cost_end')) }}">- </div>-- @if ($errors->has('quantity_cost_start') || $errors->has('quantity_cost_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('quantity_cost_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('quantity_cost_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Min. Quantity -->- <div class="form-group min_quantity-range{{ ($errors->has('min_quantity_cost_start') || $errors->has('min_quantity_cost_end')) ? ' has-error' : '' }}">- <label for="min_quantity_cost_start" class="col-md-3 control-label">{{ trans('mail.min_QTY') }}</label>- <div class="input-group col-md-7">- <input type="number" min="0" class="form-control" name="min_quantity_cost_start" aria-label="min_quantity_cost_start" value="{{ $template->textValue('min_quantity_cost_start', old('min_quantity_cost_start')) }}">- <span class="input-group-addon"> - </span>- <input type="number" min="0" class="form-control" name="min_quantity_cost_end" aria-label="min_quantity_cost_end" value="{{ $template->textValue('min_quantity_cost_end', old('min_quantity_cost_end')) }}">- </div>-- @if ($errors->has('min_quantity_cost_start') || $errors->has('min_quantity_cost_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('min_quantity_cost_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('min_quantity_cost_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Checkout Date -->- <div class="form-group checkout-range{{ ($errors->has('checkout_date_start') || $errors->has('checkout_date_end')) ? ' has-error' : '' }}">- <label for="checkout_date" class="col-md-3 control-label">{{ trans('general.checkout') }} </label>- <div class="input-daterange input-group col-md-7" id="checkout-range-datepicker">- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="checkout_date_start" aria-label="checkout_date_start" value="{{ $template->textValue('checkout_date_start', old('checkout_date_start')) }}">- <span class="input-group-addon"> - </span>- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="checkout_date_end" aria-label="checkout_date_end" value="{{ $template->textValue('checkout_date_end', old('checkout_date_end')) }}">- </div>-- @if ($errors->has('checkout_date_start') || $errors->has('checkout_date_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('checkout_date_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('checkout_date_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Created Date -->- <div class="form-group created-range{{ ($errors->has('created_start') || $errors->has('created_end')) ? ' has-error' : '' }}">- <label for="created_start" class="col-md-3 control-label">{{ trans('general.created_at') }} </label>- <div class="input-daterange input-group col-md-7" id="created-range-datepicker">- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="created_start" aria-label="created_start" value="{{ $template->textValue('created_start', old('created_start')) }}">- <span class="input-group-addon"> - </span>- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="created_end" aria-label="created_end" value="{{ $template->textValue('created_end', old('created_end')) }}">- </div>-- @if ($errors->has('created_start') || $errors->has('created_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('created_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('created_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Last updated Date -->- <div class="form-group last_updated-range{{ ($errors->has('last_updated_start') || $errors->has('last_updated_end')) ? ' has-error' : '' }}">- <label for="last_updated_start" class="col-md-3 control-label">{{ trans('general.updated_at') }}</label>- <div class="input-daterange input-group col-md-7" id="last_updated-range-datepicker">- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="last_updated_start" aria-label="last_updated_start" value="{{ $template->textValue('last_updated_start', old('last_updated_start')) }}">- <span class="input-group-addon"> - </span>- <input type="text" placeholder="{{ trans('general.select_date') }}" class="form-control" name="last_updated_end" aria-label="last_updated_end" value="{{ $template->textValue('last_updated_end', old('last_updated_end')) }}">- </div>-- @if ($errors->has('last_updated_start') || $errors->has('last_updated_end'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('last_updated_start', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- {!! $errors->first('last_updated_end', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <!-- Last Updated before -->- <div class="form-group">- <label for="last_updated_before" class="col-md-3 control-label">{{ trans('general.updated_before') }}</label>- <div class="input-group col-md-2">- <input class="form-control input-group" type="number" min="0" name="last_updated_before" value="{{ $template->textValue('last_updated_before', old('last_updated_before')) }}" aria-label="last_updated_before">- {{ trans('general.days_ago') }}- </div>-- @if ($errors->has('last_updated_before'))- <div class="col-md-9 col-lg-offset-3">- {!! $errors->first('last_updated_before', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- @endif- </div>-- <div class="col-md-9 col-md-offset-3">- <label class="form-control">- <input type="checkbox" name="use_bom" value="1" @checked($template->checkmarkValue('use_bom', '0')) />- {{ trans('general.bom_remark') }}- </label>- </div>-- <div class="col-md-9 col-md-offset-3">- <label class="form-control">- <input- name="deleted_accessories"- id="deleted_accessories_exclude_deleted"- type="radio"- value="exclude_deleted"- @checked($template->radioValue('deleted_accessories', 'exclude_deleted', true))- aria-label="deleted_accessories"- >- Exclude Deleted Accessories- </label>- <label class="form-control">- <input- name="deleted_accessories"- id="deleted_accessories_include_deleted"- type="radio"- value="include_deleted"- @checked($template->radioValue('deleted_accessories', 'include_deleted'))- aria-label="deleted_accessories"- >- Include Deleted Accessories- </label>- <label class="form-control">- <input- name="deleted_accessories"- type="radio"- id="deleted_accessories_only_deleted"- value="only_deleted"- @checked($template->radioValue('deleted_accessories', 'only_deleted'))- aria-label="deleted_accessories"- >- Only Deleted Accessories- </label>- </div>- </div>-- </div> <!-- /.box-body-->- <div class="box-footer text-right">- @if(request()->routeIs('report-templates.edit'))- <button type="submit" class="btn btn-success">- <i class="fas fa-download icon-white" aria-hidden="true"></i>- {{ trans('general.save') }}- </button>- @else- <button type="submit" class="btn btn-success">- <i class="fas fa-download icon-white" aria-hidden="true"></i>- {{ trans('general.generate') }}- </button>- @endif- </div>- </div> <!--/.box.box-default-->- </form>- </div>-- <!-- Saved Reports right column -->- <div class="col-md-3">- @if (! request()->routeIs('report-templates.edit'))- <div class="form-group">- <label for="saved_report_select">{{ trans('admin/reports/general.open_saved_template') }}</label>- <select- id="saved_report_select"- class="form-control select2"- data-placeholder="{{ trans('admin/reports/general.select_a_template') }}"- >- <option></option>- @foreach($report_templates as $savedTemplate)- <option- value="{{ $savedTemplate->id }}"- data-route="{{ route('report-templates.show', $savedTemplate->id) }}"- @selected($savedTemplate->is(request()->route()->parameter('reportTemplate')))- >- {{ $savedTemplate->name }}- </option>- @endforeach- </select>- </div>-- <div class="row">- <div class="col-md-12">-- <div style="margin-bottom: 5px;">- @if($template->name)- @if($template->created_by == auth()->id())- <span class="text-center">{!! ($template->is_shared ? '<i class="fa fa-users"></i>'." ".(trans('admin/reports/general.template_shared_with_others')) : '<i class="fa fa-user"></i>'." ".(trans('admin/reports/general.template_not_shared')) )!!}</span>- @else- <span class="text-center">{!! ($template->is_shared ? '<i class="fa fa-users"></i>'." ".(trans('admin/reports/general.template_shared')) : '<i class="fa fa-user"></i>'." ".(trans('admin/reports/general.template_not_shared')) )!!}</span>- @endif- @endif- </div>--- @if($template->created_by == auth()->id())- @if (request()->routeIs('report-templates.show'))- <a- href="{{ route('report-templates.edit', $template) }}"- class="btn btn-sm btn-warning btn-social btn-block"- data-tooltip="true"- title="{{ trans('admin/reports/general.update_template') }}"- style="margin-bottom: 5px;"- >- <x-icon type="edit" />- {{ trans('general.update') }}- </a>- <span data-tooltip="true" title="{{ trans('general.delete') }}">- <a href="#"- class="btn btn-sm btn-danger btn-social btn-block delete-accessory"- data-toggle="modal"- data-title="{{ trans('general.delete') }}"- data-content="{{ trans('general.delete_confirm', ['item' => $template->name]) }}"- data-target="#dataConfirmModal"- type="button"- >- <x-icon type="delete" />- {{ trans('general.delete') }}- </a>- </span>- @endif- @endif- </div>- </div>- @endif- @if (request()->routeIs('reports/custom', 'reports.custom.accessory'))- <hr>- <div class="form-group">- <form method="post" id="savetemplateform" action="{{ route("report-templates.store") }}">- @csrf- <input type="hidden" id="savetemplateform" name="options">- <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">- <label for="name">{{ trans('admin/reports/general.template_name') }}</label>- <input- class="form-control"- placeholder=""- name="name"- type="text"- id="name"- value="{{ $template->name }}"- required- >- {!! $errors->first('name', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}- </div>- <button class="btn btn-primary" style="width: 100%">- {{ trans('admin/reports/general.save_template') }}- </button>- </form>- </div>- <div class="box box-success">- <div class="box-header with-border">- <h4>{{ trans('admin/reports/message.about_templates') }}</h4>- </div>- <div class="box-body">- <p>{!! trans('admin/reports/message.saving_templates_description') !!}</p>- </div>- </div>- @endif- </div>- </div>--@stop--@section('moar_scripts')- <script>- // $('.purchase-range .input-daterange').datepicker({- // clearBtn: true,- // todayHighlight: true,- // endDate: '0d',- // format: 'yyyy-mm-dd',- // keepEmptyValues: true,- // });-- $("#checkAll").change(function () {- $("#included_fields_wrapper input:checkbox").prop('checked', $(this).prop("checked"));- });-- {{--$("#savetemplateform").submit(function(e) {--}}- {{-- e.preventDefault(e);--}}-- {{-- let form = $('#custom-report-form');--}}- {{-- $('<input>').attr({--}}- {{-- type: 'hidden',--}}- {{-- name: 'name',--}}- {{-- value: $('#name').val(),--}}- {{-- }).appendTo(form);--}}-- {{-- form.attr('action', '{{ route('report-templates.store') }}').submit();--}}- {{--});--}}-- // $('#saved_report_select')- // .on('select2:select', function (event) {- // window.location.href = event.params.data.element.dataset.route;- // });-- </script>-@stopdiff --git a/routes/web.php b/routes/web.phpindex de0a94a0d4..d67275c6de 100644--- a/routes/web.php+++ b/routes/web.php@@ -21,7 +21,6 @@ use App\Http\Controllers\ManufacturersController;use App\Http\Controllers\ModalController;use App\Http\Controllers\NotesController;use App\Http\Controllers\ProfileController;-use App\Http\Controllers\Reports\CustomAccessoryReportController;use App\Http\Controllers\Reports\CustomComponentReportController;use App\Http\Controllers\ReportsController;use App\Http\Controllers\ReportTemplatesController;@@ -461,7 +460,7 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {Route::get('/', [ReportsController::class, 'index'])->name('reports.index')- ->breadcrumbs(fn(Trail $trail) => $trail->parent('home')+ ->breadcrumbs(fn (Trail $trail) => $trail->parent('home')->push(trans('general.reports'), route('reports.index')));Route::get('audit', [ReportsController::class, 'audit'])@@ -511,7 +510,7 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {Route::get('accessories', [ReportsController::class, 'getAccessoryReport'])->name('reports/accessories')- ->breadcrumbs(fn(Trail $trail) => $trail->parent('home')+ ->breadcrumbs(fn (Trail $trail) => $trail->parent('home')->push(trans('general.reports'), route('reports.index'))->push(trans('general.accessory_report'), route('reports/accessories')));@@ -521,24 +520,16 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {Route::group(['prefix' => 'custom'], function () {Route::get('/', [ReportsController::class, 'getCustomReport'])->name('reports/custom')- ->breadcrumbs(fn(Trail $trail) => $trail->parent('home')+ ->breadcrumbs(fn (Trail $trail) => $trail->parent('home')->push(trans('general.reports'), route('reports.index'))->push(trans('general.custom_report'), route('reports/custom')));Route::post('/', [ReportsController::class, 'postCustom'])->name('reports.post-custom');- Route::get('accessory', [CustomAccessoryReportController::class, 'show'])- ->name('reports.custom.accessory')- ->breadcrumbs(fn(Trail $trail) => $trail->parent('home')- ->push('Custom Accessory Report', route('reports.custom.accessory')));-- Route::post('accessory', [CustomAccessoryReportController::class, 'run'])- ->name('reports.custom.accessory.run');-Route::get('component', [CustomComponentReportController::class, 'show'])->name('reports.custom.component')- ->breadcrumbs(fn(Trail $trail) => $trail->parent('home')+ ->breadcrumbs(fn (Trail $trail) => $trail->parent('home')->push('Custom Component Report', route('reports.custom.component')));Route::post('component', [CustomComponentReportController::class, 'run'])diff --git a/tests/Feature/Reporting/Custom/CustomAccessoryReportTest.php b/tests/Feature/Reporting/Custom/CustomAccessoryReportTest.phpdeleted file mode 100644index caad3094cb..0000000000--- a/tests/Feature/Reporting/Custom/CustomAccessoryReportTest.php+++ /dev/null@@ -1,219 +0,0 @@-<?php--namespace Tests\Feature\Reporting\Custom;--use App\Models\Accessory;-use App\Models\Company;-use App\Models\ReportTemplate;-use App\Models\User;-use PHPUnit\Framework\Attributes\Group;-use Tests\TestCase;--#[Group('custom-reporting')]-class CustomAccessoryReportTest extends TestCase-{- public function test_requires_permission_to_view_page()- {- $this->actingAs(User::factory()->create())- ->get(route('reports.custom.accessory'))- ->assertForbidden();- }-- public function test_requires_permission_to_run_report()- {- $this->actingAs(User::factory()->create())- ->post(route('reports.custom.accessory.run'), [- //- ])- ->assertForbidden();- }-- public function test_can_load_custom_report_page()- {- $this->actingAs(User::factory()->canViewReports()->create())- ->get(route('reports.custom.accessory'))- ->assertOk();- }-- public function test_saved_templates_on_page_are_scoped_to_the_user_and_type()- {- // Given there are saved templates for one user- ReportTemplate::factory()->create(['type' => 'asset', 'name' => 'Another User: Asset']);- ReportTemplate::factory()->create(['type' => 'accessory', 'name' => 'Another User: Accessory']);- ReportTemplate::factory()->create(['type' => 'component', 'name' => 'Another User: Component']);-- // When loading reports.custom.accessory while acting as another user that also has saved templates- $user = User::factory()->canViewReports()- ->has(ReportTemplate::factory(['type' => 'asset', 'name' => 'User: Asset']))- ->has(ReportTemplate::factory(['type' => 'accessory', 'name' => 'User: Accessory']))- ->has(ReportTemplate::factory(['type' => 'component', 'name' => 'User: Component']))- ->create();-- $response = $this->actingAs($user)->get(route('reports.custom.accessory'));-- $viewTemplateNames = $response->viewData('report_templates')->pluck('name');-- // The user should only see their accessory template- $this->assertTrue($viewTemplateNames->contains('User: Accessory'));- $this->assertTrue($viewTemplateNames->doesntContain('User: Asset'));- $this->assertTrue($viewTemplateNames->doesntContain('User: Component'));- $this->assertTrue($viewTemplateNames->doesntContain('Another User: Asset'));- $this->assertTrue($viewTemplateNames->doesntContain('Another User: Accessory'));- $this->assertTrue($viewTemplateNames->doesntContain('Another User: Component'));- }-- public function test_custom_accessory_report()- {- $this->markTestIncomplete();-- Accessory::factory()->create(['name' => 'Accessory A']);- Accessory::factory()->create(['name' => 'Accessory B']);-- $this->actingAs(User::factory()->canViewReports()->create())- ->post(route('reports.custom.accessory.run'), [- // todo:- ])->assertOk()- ->assertHeader('content-type', 'text/csv; charset=utf-8')- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');- }-- public function test_custom_accessory_report_headers()- {- $this->markTestIncomplete();-- $this->actingAs(User::factory()->canViewReports()->create())- ->post(route('reports.custom.accessory.run'), [- 'id' => '1',- 'company' => '1',- 'accessory_name' => '1',- 'manufacturer' => '1',- 'model' => '1',- 'category' => '1',- 'purchase_date' => '1',- 'purchase_cost' => '1',- 'order' => '1',- 'quantity' => '1',- 'supplier' => '1',- 'location' => '1',- 'location_address' => '1',- 'min_amount' => '1',- 'checkout_date' => '1',- 'created_at' => '1',- 'updated_at' => '1',- 'deleted_at' => '1',- 'notes' => '1',- 'assigned_to' => '1',- 'username' => '1',- 'user_company' => '1',- 'email' => '1',- 'employee_num' => '1',- 'manager' => '1',- 'department' => '1',- 'title' => '1',- 'phone' => '1',- 'user_address' => '1',- 'user_city' => '1',- 'user_state' => '1',- 'user_country' => '1',- 'user_zip' => '1',- 'target_notes' => '1',-- ])->assertOk()- ->assertHeader('content-type', 'text/csv; charset=utf-8')- ->assertSeeTextInStreamedResponse(trans('general.id'))- ->assertSeeTextInStreamedResponse(trans('general.company'))- ->assertSeeTextInStreamedResponse(trans('admin/accessories/general.accessory_name'))- ->assertSeeTextInStreamedResponse(trans('general.manufacturer'))- ->assertSeeTextInStreamedResponse(trans('general.model_no'))- ->assertSeeTextInStreamedResponse(trans('general.category'))- ->assertSeeTextInStreamedResponse(trans('admin/licenses/table.purchase_date'))- ->assertSeeTextInStreamedResponse(trans('admin/hardware/form.cost'))- ->assertSeeTextInStreamedResponse(trans('admin/hardware/form.order'))- ->assertSeeTextInStreamedResponse(trans('general.quantity'))- ->assertSeeTextInStreamedResponse(trans('general.suppliers'))- ->assertSeeTextInStreamedResponse(trans('general.location'))- ->assertSeeTextInStreamedResponse(trans('general.address'))- ->assertSeeTextInStreamedResponse(trans('general.min_amt'))- ->assertSeeTextInStreamedResponse(trans('admin/hardware/table.checkout_date'))- ->assertSeeTextInStreamedResponse(trans('general.created_at'))- ->assertSeeTextInStreamedResponse(trans('general.updated_at'))- ->assertSeeTextInStreamedResponse(trans('general.deleted'))- ->assertSeeTextInStreamedResponse(trans('general.notes'))- ->assertSeeTextInStreamedResponse(trans('general.checked_out_to_fields'))- ->assertSeeTextInStreamedResponse(trans('admin/licenses/table.assigned_to'))- ->assertSeeTextInStreamedResponse(trans('admin/users/table.username'))- ->assertSeeTextInStreamedResponse(trans('admin/reports/general.custom_export.user_company'))- ->assertSeeTextInStreamedResponse(trans('admin/users/table.email'))- ->assertSeeTextInStreamedResponse(trans('general.employee_number'))- ->assertSeeTextInStreamedResponse(trans('admin/users/table.manager'))- ->assertSeeTextInStreamedResponse(trans('general.department'))- ->assertSeeTextInStreamedResponse(trans('admin/users/table.title'))- ->assertSeeTextInStreamedResponse(trans('admin/users/table.phone'))- ->assertSeeTextInStreamedResponse(trans('general.address'))- ->assertSeeTextInStreamedResponse(trans('general.city'))- ->assertSeeTextInStreamedResponse(trans('general.state'))- ->assertSeeTextInStreamedResponse(trans('general.country'))- ->assertSeeTextInStreamedResponse(trans('general.zip'))- ->assertSeeTextInStreamedResponse(trans('admin/reports/general.custom_export.target_notes'));- }-- public function test_custom_accessory_report_content()- {- $this->markTestIncomplete();- // todo: might be merged with the test above- }-- public function test_custom_accessory_report_exclude_deleted()- {- $this->markTestIncomplete();- }-- public function test_custom_accessory_report_adheres_to_company_scoping()- {- $this->markTestIncomplete();-- [$companyA, $companyB] = Company::factory()->count(2)->create()->all();-- Accessory::factory()->for($companyA)->create(['name' => 'Accessory A']);- Accessory::factory()->for($companyB)->create(['name' => 'Accessory B']);-- $superUser = $companyA->users()->save(User::factory()->superuser()->make());- $userInCompanyA = $companyA->users()->save(User::factory()->canViewReports()->make());- $userInCompanyB = $companyB->users()->save(User::factory()->canViewReports()->make());-- $this->settings->disableMultipleFullCompanySupport();-- $this->actingAs($superUser)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');-- $this->actingAs($userInCompanyA)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');-- $this->actingAs($userInCompanyB)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');-- $this->settings->enableMultipleFullCompanySupport();-- $this->actingAs($superUser)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');-- $this->actingAs($userInCompanyA)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertSeeTextInStreamedResponse('Accessory A')- ->assertDontSeeTextInStreamedResponse('Accessory B');-- $this->actingAs($userInCompanyB)- ->post(route('reports.custom.accessory.run'), ['asset_name' => '1'])- ->assertDontSeeTextInStreamedResponse('Accessory A')- ->assertSeeTextInStreamedResponse('Accessory B');- }-}diff --git a/tests/Feature/Reporting/Custom/CustomAssetReportTest.php b/tests/Feature/Reporting/Custom/CustomAssetReportTest.phpindex ac093f66a4..c0373ff6e6 100644--- a/tests/Feature/Reporting/Custom/CustomAssetReportTest.php+++ b/tests/Feature/Reporting/Custom/CustomAssetReportTest.php@@ -48,12 +48,12 @@ class CustomAssetReportTest extends TestCase{// Given there are saved templates for one userReportTemplate::factory()->create(['type' => 'asset', 'name' => 'Another User: Asset']);- ReportTemplate::factory()->create(['type' => 'accessory', 'name' => 'Another User: Accessory']);+ ReportTemplate::factory()->create(['type' => 'component', 'name' => 'Another User: Component']);// When loading reports/custom while acting as another user that also has saved templates$user = User::factory()->canViewReports()->has(ReportTemplate::factory(['type' => 'asset', 'name' => 'User: Asset']))- ->has(ReportTemplate::factory(['type' => 'accessory', 'name' => 'User: Accessory']))+ ->has(ReportTemplate::factory(['type' => 'component', 'name' => 'User: Component']))->create();$response = $this->actingAs($user)->get(route('reports/custom'));@@ -62,9 +62,9 @@ class CustomAssetReportTest extends TestCase// The user should only see their asset template$this->assertTrue($viewTemplateNames->contains('User: Asset'));- $this->assertTrue($viewTemplateNames->doesntContain('User: Accessory'));+ $this->assertTrue($viewTemplateNames->doesntContain('User: Component'));$this->assertTrue($viewTemplateNames->doesntContain('Another User: Asset'));- $this->assertTrue($viewTemplateNames->doesntContain('Another User: Accessory'));+ $this->assertTrue($viewTemplateNames->doesntContain('Another User: Component'));}public function test_custom_asset_report()