From c9747b00a364710416d6323dcd304dd6d6bb9335 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 24 Jun 2025 19:21:17 -0400 Subject: [PATCH 01/15] pushing this up. added livewire note --- resources/views/users/print.blade.php | 69 +++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 9ed76ae3f067..72cc3ef501ac 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -124,6 +124,7 @@ class="snipe-table table table-striped inventory" {{ trans('admin/hardware/form.serial') }} {{ trans('admin/hardware/table.checkout_date') }} {{ trans('general.signature') }} + {{ trans('general.custom') }} @foreach ($show_user->assets as $asset) @@ -151,6 +152,9 @@ class="snipe-table table table-striped inventory" @endif + + {{ $asset->fetchCustomFields() }} + @if ($settings->show_assigned_assets) @php @@ -524,5 +528,70 @@ classes: 'table table-responsive table-no-bordered', }); + + From d256dc627f212bbe50e8d3629304c224d4967336 Mon Sep 17 00:00:00 2001 From: akemidx Date: Mon, 7 Jul 2025 20:09:46 -0400 Subject: [PATCH 02/15] migration and checkbox --- ...dd_custom_fields_to_print_all_assigned.php | 30 +++++++++++++++++++ .../views/custom_fields/fields/edit.blade.php | 7 +++++ 2 files changed, 37 insertions(+) create mode 100644 database/migrations/2025_07_07_235712_add_custom_fields_to_print_all_assigned.php diff --git a/database/migrations/2025_07_07_235712_add_custom_fields_to_print_all_assigned.php b/database/migrations/2025_07_07_235712_add_custom_fields_to_print_all_assigned.php new file mode 100644 index 000000000000..11e4685e8907 --- /dev/null +++ b/database/migrations/2025_07_07_235712_add_custom_fields_to_print_all_assigned.php @@ -0,0 +1,30 @@ +boolean('display_on_print_assigned')->nullable()->default(0); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('custom_fields', function (Blueprint $table) { + if (Schema::hasColumn('custom_fields', 'display_on_print_assigned')) { + $table->dropColumn('display_on_print_assigned'); + } + }); + } +}; diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php index 07a21b089f15..9880a38c8c98 100644 --- a/resources/views/custom_fields/fields/edit.blade.php +++ b/resources/views/custom_fields/fields/edit.blade.php @@ -244,6 +244,13 @@ class="format form-control" + +
+ +
From 9993bd6942bd4f5f6137b20fdc3bcad1e1fa8b37 Mon Sep 17 00:00:00 2001 From: akemidx Date: Mon, 7 Jul 2025 20:44:51 -0400 Subject: [PATCH 03/15] added to controller --- app/Http/Controllers/CustomFieldsController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index 7862719276a3..5969931a5649 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -107,7 +107,9 @@ public function store(CustomFieldRequest $request) : RedirectResponse "display_checkin" => $request->input("display_checkin", 0), "display_checkout" => $request->input("display_checkout", 0), "display_audit" => $request->input("display_audit", 0), - "created_by" => auth()->id() + "display_on_print_assigned" => $request->input('display_on_print_assigned', 0), + + "created_by" => auth()->id() ]); @@ -252,6 +254,8 @@ public function update(CustomFieldRequest $request, CustomField $field) : Redire $field->display_checkin = $request->get("display_checkin", 0); $field->display_checkout = $request->get("display_checkout", 0); $field->display_audit = $request->get("display_audit", 0); + $field->display_on_print_assigned = $request->input('display_on_print_assigned', 0); + if ($request->get('format') == 'CUSTOM REGEX') { $field->format = $request->get('custom_format'); From e2a1e2af0e8ecfd4e8288150a1bcc09680a24dc1 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 8 Jul 2025 14:56:06 -0400 Subject: [PATCH 04/15] checkbox works --- .../views/custom_fields/fields/edit.blade.php | 4 +++- resources/views/custom_fields/index.blade.php | 20 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php index 9880a38c8c98..03cb2acf2b9f 100644 --- a/resources/views/custom_fields/fields/edit.blade.php +++ b/resources/views/custom_fields/fields/edit.blade.php @@ -245,6 +245,7 @@ class="format form-control"
+
- + +
- +
+{{-- @php--}} +{{-- dd($show_user->id);--}} +{{-- @endphp--}} + + - - - - - - - - - - - - - - - - @foreach ($show_user->assets as $asset) - @php - if (($asset->model->category) && ($asset->model->category->getEula())) $eulas[] = $asset->model->category->getEula() - @endphp - - - - - - - - - - - - - - {{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} - {{-- probably a mess under the hood, but that seems the most streamlined way?--}} - {{-- wait, what if the custom field is encrypted--}} - {{----}} - - @if ($settings->show_assigned_assets) - @php - $assignedCounter = 1; - @endphp - @foreach ($asset->assignedAssets as $asset) - - - - - - - - - - - - - - @php - $assignedCounter++ - @endphp - @endforeach - @endif - @php - $counter++ - @endphp - @endforeach - + data-cookie-id-table="AssetsAssigned" + data-url="{{ route('api.assets.index',['assigned_to' => $show_user->id, 'assigned_type' => 'App\Models\User']) }}"> + + +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} + +{{-- --}} +{{-- --}} +{{-- --}} +{{-- @foreach ($show_user->assets as $asset)--}} +{{-- @php--}} +{{-- if (($asset->model->category) && ($asset->model->category->getEula())) $eulas[] = $asset->model->category->getEula()--}} +{{-- @endphp--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}}{{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} +{{-- --}}{{-- probably a mess under the hood, but that seems the most streamlined way?--}} +{{-- --}}{{-- wait, what if the custom field is encrypted--}} +{{-- --}}{{----}} +{{-- --}} +{{-- @if ($settings->show_assigned_assets)--}} +{{-- @php--}} +{{-- $assignedCounter = 1;--}} +{{-- @endphp--}} +{{-- @foreach ($asset->assignedAssets as $asset)--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- --}} +{{-- @php--}} +{{-- $assignedCounter++--}} +{{-- @endphp--}} +{{-- @endforeach--}} +{{-- @endif--}} +{{-- @php--}} +{{-- $counter++--}} +{{-- @endphp--}} +{{-- @endforeach--}} +{{-- --}}
#{{ trans('general.image') }}{{ trans('admin/hardware/table.asset_tag') }}{{ trans('general.name') }}{{ trans('general.category') }}{{ trans('admin/hardware/form.model') }}{{ trans('admin/hardware/form.default_location') }}{{ trans('general.location') }}{{ trans('admin/hardware/form.serial') }}{{ trans('admin/hardware/table.checkout_date') }}{{ trans('general.signature') }}{{ trans('general.custom') }} header loop go here
{{ $counter }} - @if ($asset->getImageUrl()) - - @endif - {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }} - {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} - @if ($asset->getLatestSignedAcceptance($show_user)) - - @endif - - data loop go here -
{{ $counter }}.{{ $assignedCounter }} - @if ($asset->getImageUrl()) - - @endif - {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }} - {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} - - @if ($asset->getLatestSignedAcceptance($show_user)) - - @endif -
#{{ trans('general.image') }}{{ trans('admin/hardware/table.asset_tag') }}{{ trans('general.name') }}{{ trans('general.category') }}{{ trans('admin/hardware/form.model') }}{{ trans('admin/hardware/form.default_location') }}{{ trans('general.location') }}{{ trans('admin/hardware/form.serial') }}{{ trans('admin/hardware/table.checkout_date') }}{{ trans('general.signature') }}{{ trans('general.custom') }} header loop go here
{{ $counter }}--}} +{{-- @if ($asset->getImageUrl())--}} +{{-- --}} +{{-- @endif--}} +{{-- {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }}--}} +{{-- {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }}--}} +{{-- @if ($asset->getLatestSignedAcceptance($show_user))--}} +{{-- --}} +{{-- @endif--}} +{{-- --}} +{{-- data loop go here--}} +{{--
{{ $counter }}.{{ $assignedCounter }}--}} +{{-- @if ($asset->getImageUrl())--}} +{{-- --}} +{{-- @endif--}} +{{-- {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }}--}} +{{-- {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }}--}} +{{-- --}} +{{-- @if ($asset->getLatestSignedAcceptance($show_user))--}} +{{-- --}} +{{-- @endif--}} +{{--
@endif @@ -501,12 +511,14 @@ classes: 'table table-responsive table-no-bordered', paginationVAlign: 'both', queryParams: function (params) { var newParams = {}; - for(var i in params) { - if(!keyBlocked(i)) { // only send the field if it's not in blockedFields - newParams[i] = params[i]; + var keyBlocked = function () { + for (var i in params) { + if (!keyBlocked(i)) { // only send the field if it's not in blockedFields + newParams[i] = params[i]; + } } + return newParams; } - return newParams; }, formatLoadingMessage: function () { return '

{{ trans('general.loading') }}

'; From 608e61f70ef2188296e349d24af8104c3fbfc5fe Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 15 Jul 2025 19:33:21 -0400 Subject: [PATCH 09/15] adding in for encryption. not saved on new field creation yet tho --- app/Http/Controllers/CustomFieldsController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index 5969931a5649..a246e09c104b 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -85,11 +85,13 @@ public function store(CustomFieldRequest $request) : RedirectResponse $show_in_email = $request->input("show_in_email", 0); $display_in_user_view = $request->input("display_in_user_view", 0); + $display_on_print_assigned = $request->input('display_on_print_assigned', 0); // Override the display settings if the field is encrypted if ($request->input("field_encrypted") == '1') { $show_in_email = '0'; $display_in_user_view = '0'; + $display_on_print_assigned = '0'; } $field = new CustomField([ @@ -107,7 +109,7 @@ public function store(CustomFieldRequest $request) : RedirectResponse "display_checkin" => $request->input("display_checkin", 0), "display_checkout" => $request->input("display_checkout", 0), "display_audit" => $request->input("display_audit", 0), - "display_on_print_assigned" => $request->input('display_on_print_assigned', 0), + "display_on_print_assigned" => $display_on_print_assigned, "created_by" => auth()->id() ]); @@ -233,11 +235,14 @@ public function update(CustomFieldRequest $request, CustomField $field) : Redire $this->authorize('update', $field); $show_in_email = $request->get("show_in_email", 0); $display_in_user_view = $request->get("display_in_user_view", 0); + $display_on_print_assigned = $request->input('display_on_print_assigned', 0); + // Override the display settings if the field is encrypted if ($request->get("field_encrypted") == '1') { $show_in_email = '0'; $display_in_user_view = '0'; + $display_on_print_assigned = '0'; } $field->name = trim($request->get("name")); @@ -254,7 +259,8 @@ public function update(CustomFieldRequest $request, CustomField $field) : Redire $field->display_checkin = $request->get("display_checkin", 0); $field->display_checkout = $request->get("display_checkout", 0); $field->display_audit = $request->get("display_audit", 0); - $field->display_on_print_assigned = $request->input('display_on_print_assigned', 0); + $field->display_on_print_assigned = $display_on_print_assigned; + if ($request->get('format') == 'CUSTOM REGEX') { From 49899932448f6de22ab613760ac702b533639cf1 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 15 Jul 2025 19:53:41 -0400 Subject: [PATCH 10/15] saved on new custom field --- app/Models/CustomField.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php index b3742882a2a3..318ca38feef0 100644 --- a/app/Models/CustomField.php +++ b/app/Models/CustomField.php @@ -83,6 +83,7 @@ class CustomField extends Model 'display_checkin', 'display_audit', 'show_in_requestable_list', + 'display_on_print_assigned', ]; /** From cabf786ebe765b582061fc87d475ef37bd63e5cb Mon Sep 17 00:00:00 2001 From: akemidx Date: Wed, 16 Jul 2025 20:15:40 -0400 Subject: [PATCH 11/15] stuck --- resources/views/users/print.blade.php | 191 +++++++++++++------------- 1 file changed, 98 insertions(+), 93 deletions(-) diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 4b7e44048d11..9d6208566377 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -106,108 +106,113 @@ - - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @foreach ($show_user->assets as $asset)--}} -{{-- @php--}} -{{-- if (($asset->model->category) && ($asset->model->category->getEula())) $eulas[] = $asset->model->category->getEula()--}} -{{-- @endphp--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}}{{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} -{{-- --}}{{-- probably a mess under the hood, but that seems the most streamlined way?--}} -{{-- --}}{{-- wait, what if the custom field is encrypted--}} -{{-- --}}{{----}} -{{-- --}} -{{-- @if ($settings->show_assigned_assets)--}} -{{-- @php--}} -{{-- $assignedCounter = 1;--}} -{{-- @endphp--}} -{{-- @foreach ($asset->assignedAssets as $asset)--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @php--}} -{{-- $assignedCounter++--}} -{{-- @endphp--}} -{{-- @endforeach--}} -{{-- @endif--}} -{{-- @php--}} -{{-- $counter++--}} -{{-- @endphp--}} -{{-- @endforeach--}} -{{-- --}} +{{-- data-url="{{ route('api.assets.index',['assigned_to' => $show_user->id, 'assigned_type' => 'App\Models\User']) }}">--}} + + + + + + + + + + + + + + + + + + + + @foreach ($show_user->assets as $asset) + @php + if (($asset->model->category) && ($asset->model->category->getEula())) $eulas[] = $asset->model->category->getEula() + @endphp + + + + + + + + + + + + + + @foreach($asset->model->fieldset->fields as $fields) + @dd($asset->model->fieldset->fields); + {{-- weird that line 167 will pop a cant read property on null, but only when the dd is not there. --}} + + @endforeach +{{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} +{{-- probably a mess under the hood, but that seems the most streamlined way?--}} + + + @if ($settings->show_assigned_assets) + @php + $assignedCounter = 1; + @endphp + @foreach ($asset->assignedAssets as $asset) + + + + + + + + + + + + + + @php + $assignedCounter++ + @endphp + @endforeach + @endif + @php + $counter++ + @endphp + @endforeach +
#{{ trans('general.image') }}{{ trans('admin/hardware/table.asset_tag') }}{{ trans('general.name') }}{{ trans('general.category') }}{{ trans('admin/hardware/form.model') }}{{ trans('admin/hardware/form.default_location') }}{{ trans('general.location') }}{{ trans('admin/hardware/form.serial') }}{{ trans('admin/hardware/table.checkout_date') }}{{ trans('general.signature') }}{{ trans('general.custom') }} header loop go here
{{ $counter }}--}} -{{-- @if ($asset->getImageUrl())--}} -{{-- --}} -{{-- @endif--}} -{{-- {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }}--}} -{{-- {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }}--}} -{{-- @if ($asset->getLatestSignedAcceptance($show_user))--}} -{{-- --}} -{{-- @endif--}} -{{-- --}} -{{-- data loop go here--}} -{{--
{{ $counter }}.{{ $assignedCounter }}--}} -{{-- @if ($asset->getImageUrl())--}} -{{-- --}} -{{-- @endif--}} -{{-- {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }}--}} -{{-- {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }}--}} -{{-- --}} -{{-- @if ($asset->getLatestSignedAcceptance($show_user))--}} -{{-- --}} -{{-- @endif--}} -{{--
#{{ trans('general.image') }}{{ trans('admin/hardware/table.asset_tag') }}{{ trans('general.name') }}{{ trans('general.category') }}{{ trans('admin/hardware/form.model') }}{{ trans('admin/hardware/form.default_location') }}{{ trans('general.location') }}{{ trans('admin/hardware/form.serial') }}{{ trans('admin/hardware/table.checkout_date') }}{{ trans('general.signature') }}{{ trans('general.custom') }} header loop go here
{{ $counter }} + @if ($asset->getImageUrl()) + + @endif + {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }} + {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} + @if ($asset->getLatestSignedAcceptance($show_user)) + + @endif + + {{ $fields }} +
{{ $counter }}.{{ $assignedCounter }} + @if ($asset->getImageUrl()) + + @endif + {{ $asset->asset_tag }}{{ $asset->name }}{{ (($asset->model) && ($asset->model->category)) ? $asset->model->category->name : trans('general.invalid_category') }}{{ ($asset->model) ? $asset->model->name : trans('general.invalid_model') }}{{ ($asset->defaultLoc) ? $asset->defaultLoc->name : '' }}{{ ($asset->location) ? $asset->location->name : '' }}{{ $asset->serial }} + {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} + + @if ($asset->getLatestSignedAcceptance($show_user)) + + @endif +
@endif From f06e30bc546f259a54c50b4b48a707801ac02fa0 Mon Sep 17 00:00:00 2001 From: akemidx Date: Thu, 17 Jul 2025 13:54:37 -0400 Subject: [PATCH 12/15] com --- resources/views/users/print.blade.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 9d6208566377..f2a74a5aece4 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -98,9 +98,6 @@ -{{-- @php--}} -{{-- dd($show_user->id);--}} -{{-- @endphp--}} {{ trans('general.signature') }} - + @foreach ($show_user->assets as $asset) @@ -164,13 +161,19 @@ class="snipe-table table table-striped inventory" @endif - @foreach($asset->model->fieldset->fields as $fields) - @dd($asset->model->fieldset->fields); - {{-- weird that line 167 will pop a cant read property on null, but only when the dd is not there. --}} - - @endforeach + + + + +{{-- @foreach($asset->model->fieldset->fields as $fields)--}} +{{-- @dd($asset->model->fieldset->fields);--}} +{{-- --}}{{-- weird that line 167 will pop a cant read property on null, but only when the dd is not there. --}} +{{-- --}} +{{-- @endforeach--}} {{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} {{-- probably a mess under the hood, but that seems the most streamlined way?--}} From 5dd532033f3da8ff48823dbd2fae06270b0f49c4 Mon Sep 17 00:00:00 2001 From: akemidx Date: Thu, 17 Jul 2025 14:27:56 -0400 Subject: [PATCH 13/15] iterations --- .../Controllers/Users/UsersController.php | 4 +- resources/views/users/print.blade.php | 38 ++++++++----------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index b18a7b6fff8d..04832a06e014 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -10,6 +10,7 @@ use App\Models\Actionlog; use App\Models\Asset; use App\Models\Company; +use App\Models\CustomField; use App\Models\Group; use App\Models\Setting; use App\Models\User; @@ -622,7 +623,8 @@ public function printInventory($id) return view('users.print') ->with('users', [$user]) - ->with('settings', Setting::getSettings()); + ->with('settings', Setting::getSettings()) + ->with('printable_customfields', CustomField::all()->filter(fn($customfield) => $customfield->display_on_print_assigned)); } return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id'))); diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index f2a74a5aece4..43d64ba57ce6 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -103,7 +103,6 @@
{{ trans('general.custom') }} header loop go here{{ trans('general.custom') }}
- {{ $fields }} - --}} +{{-- @if($fields->display_on_print_assigned=='1')--}} +{{-- $fields;--}} +{{-- @endif--}} +{{--
--}} + data-cookie-id-table="AssetsAssigned"> @@ -129,11 +127,16 @@ class="snipe-table table table-striped inventory" - + @foreach($printable_customfields as $customfield) + + @endforeach - - + + + @foreach ($show_user->assets as $asset) @php @@ -155,28 +158,19 @@ class="snipe-table table table-striped inventory" + + @foreach($printable_customfields as $customfield) + + @endforeach + - - - - -{{-- @foreach($asset->model->fieldset->fields as $fields)--}} -{{-- @dd($asset->model->fieldset->fields);--}} -{{-- --}}{{-- weird that line 167 will pop a cant read property on null, but only when the dd is not there. --}} -{{-- --}} -{{-- @endforeach--}} -{{-- wouldn't this actually search for the checked custom fields, build an array of those, and then add on columns as needed?--}} -{{-- probably a mess under the hood, but that seems the most streamlined way?--}} - @if ($settings->show_assigned_assets) @php From 346b1b95706b4715ac8419364428bea9f4e3efad Mon Sep 17 00:00:00 2001 From: akemidx Date: Thu, 17 Jul 2025 17:01:58 -0400 Subject: [PATCH 14/15] fixing iteration and adding hiding encrypted feels --- app/Http/Controllers/Users/UsersController.php | 4 +++- resources/views/users/print.blade.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 04832a06e014..1acda4692fe7 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -624,7 +624,9 @@ public function printInventory($id) return view('users.print') ->with('users', [$user]) ->with('settings', Setting::getSettings()) - ->with('printable_customfields', CustomField::all()->filter(fn($customfield) => $customfield->display_on_print_assigned)); + ->with('printable_customfields', CustomField::all()->filter(function ($customfield) { + return $customfield->display_on_print_assigned && $customfield->field_encrypted == 0; + })); } return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id'))); diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 43d64ba57ce6..ba76ff885d91 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -117,7 +117,7 @@ class="snipe-table table table-striped inventory" - + @@ -129,7 +129,7 @@ class="snipe-table table table-striped inventory" @foreach($printable_customfields as $customfield) - @endforeach @@ -160,7 +160,7 @@ class="snipe-table table table-striped inventory" {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} @foreach($printable_customfields as $customfield) - @endforeach From 158b7642d7829b6db3e215de192dcfcc80ed224c Mon Sep 17 00:00:00 2001 From: akemidx Date: Thu, 28 Aug 2025 18:40:15 -0400 Subject: [PATCH 15/15] note for NOT displaying custom fields --- app/Http/Controllers/Users/UsersController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 595a84262d0c..dae8d356ede7 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -619,6 +619,7 @@ public function printInventory($id) ->with('settings', Setting::getSettings()) ->with('printable_customfields', CustomField::all()->filter(function ($customfield) { return $customfield->display_on_print_assigned && $customfield->field_encrypted == 0; + //This should make it to NOT show encrypted custom fields on the printout })); }
{{ trans('general.location') }} {{ trans('admin/hardware/form.serial') }} {{ trans('admin/hardware/table.checkout_date') }}{{ trans('general.signature') }} + {{$customfield->name}} + {{ trans('general.custom') }}
{{ trans('general.signature') }}
{{ $asset->serial }} {{ Helper::getFormattedDateObject($asset->last_checkout, 'datetime', false) }} + {{ $asset->{$customfield->db_column} }} + @if ($asset->getLatestSignedAcceptance($show_user)) @endif --}} -{{-- @if($fields->display_on_print_assigned=='1')--}} -{{-- $fields;--}} -{{-- @endif--}} -{{--
## {{ trans('general.image') }} {{ trans('admin/hardware/table.asset_tag') }} {{ trans('general.name') }}{{ trans('admin/hardware/table.checkout_date') }} + {{$customfield->name}} + {{ $asset->{$customfield->db_column} }}