-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fixed #15664 - Adds Accessories, Components, Consumables, and Licenses to Unaccepted Assets report #17913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Godmartinz
wants to merge
24
commits into
grokability:develop
Choose a base branch
from
Godmartinz:add_types_to_unaccepted_asset_report
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixed #15664 - Adds Accessories, Components, Consumables, and Licenses to Unaccepted Assets report #17913
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
58eac61
add checkoutable class, rework blade for unaccepted items
Godmartinz dcbb09b
added checkoutable class
Godmartinz 51ce570
attempt to sort chronologically, can not resort still
Godmartinz a6cb75c
remove sorter, didnt work
Godmartinz ab30df1
remove sorter from blade
Godmartinz 7077faa
updated the postassetAcceptanceReport query and rows
Godmartinz ca8eae4
updated the csv values to be plain
Godmartinz 20adad3
fix company name link, clean up query
Godmartinz 5af85bf
further clean up
Godmartinz 6f3323c
fix data in view model
Godmartinz 2b5254e
fixed, eager loading, variable names, clean up
Godmartinz 3527c35
whoops
Godmartinz d31d99b
remove else and blank lines
Godmartinz 0ce20c1
fix send reminder method to handle other types
Godmartinz 9ac2ea2
fix test to check all mailable types for reminders
Godmartinz bf6964e
tests passing, CheckoutAcceptance Factory needs eyes though
Godmartinz 6ca0e19
uncomment code
Godmartinz 6f990dd
adds an option to disable Auto assigned an actionlogs in factories
Godmartinz 533d82d
remove unnecessary changes
Godmartinz 82bdd43
renamed variable
Godmartinz fea0189
Merge branch 'fix-factory-auto-gen-action-logs' into add_types_to_una…
Godmartinz 881c789
add usuage of withoutactionlog
Godmartinz 3ae7a77
update the snipeit reminder command
Godmartinz ca44ee9
Merge pull request #28 from Godmartinz/add_types_to_command
Godmartinz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use App\Helpers\Helper; | ||
Godmartinz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
class Checkoutable | ||
{ | ||
public function __construct( | ||
public int $acceptance_id, | ||
public string $company, | ||
public string $category, | ||
public string $model, | ||
public string $asset_tag, | ||
public string $name, | ||
public string $type, | ||
public object $acceptance, | ||
public object $assignee, | ||
public readonly string $category_plain, | ||
public readonly string $model_plain, | ||
public readonly string $name_plain, | ||
public readonly string $company_plain, | ||
Godmartinz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
){} | ||
|
||
// public static function fromCheckoutable(Asset|Accessory|etc..) | ||
// { | ||
// | ||
// } | ||
Godmartinz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
public static function fromAcceptance(CheckoutAcceptance $unaccepted): self | ||
{ | ||
$unaccepted_row = $unaccepted->checkoutable; | ||
$acceptance = $unaccepted; | ||
|
||
$assignee = $acceptance->assignedTo; | ||
$company = optional($unaccepted_row->company)->present()?->nameUrl() ?? ''; | ||
Godmartinz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$category = $model = $name = $tag = ''; | ||
$type = $acceptance->checkoutable_item_type ?? ''; | ||
|
||
|
||
if($unaccepted_row instanceof Asset){ | ||
$category = optional($unaccepted_row->model?->category?->present())->nameUrl() ?? ''; | ||
$model = optional($unaccepted_row->present())->modelUrl() ?? ''; | ||
$name = optional($unaccepted_row->present())->nameUrl() ?? ''; | ||
$tag = (string) ($unaccepted_row->asset_tag ?? ''); | ||
} | ||
elseif($unaccepted_row instanceof Accessory){ | ||
$category = optional($unaccepted_row->category?->present())->nameUrl() ?? ''; | ||
$model = $unaccepted_row->model_number ?? ''; | ||
$name = optional($unaccepted_row->present())->nameUrl() ?? ''; | ||
|
||
} | ||
if($unaccepted_row instanceof LicenseSeat){ | ||
$category = optional($unaccepted_row->license->category?->present())->nameUrl() ?? ''; | ||
$company = optional($unaccepted_row->license->company?->present())?->nameUrl() ?? ''; | ||
$model = ''; | ||
$name = $unaccepted_row->license->name ?? ''; | ||
} | ||
if($unaccepted_row instanceof Consumable){ | ||
$category = optional($unaccepted_row->category?->present())->nameUrl() ?? ''; | ||
$model = $unaccepted_row->model_number ?? ''; | ||
$name = $unaccepted_row?->present()?->nameUrl() ?? ''; | ||
|
||
} | ||
if($unaccepted_row instanceof Component){ | ||
$category = optional($unaccepted_row->category?->present())->nameUrl() ?? ''; | ||
$model = $unaccepted_row->model_number ?? ''; | ||
$name = $unaccepted_row?->present()?->nameUrl() ?? ''; | ||
|
||
} | ||
$created = $acceptance->created_at; | ||
|
||
return new self( | ||
acceptance_id: $acceptance->id, | ||
company: $company, | ||
category: $category, | ||
model: $model, | ||
asset_tag: $tag, | ||
name: $name, | ||
type: $type, | ||
acceptance: $acceptance, | ||
assignee: $assignee, | ||
//plain text for CSVs | ||
category_plain: ($unaccepted_row->model?->category?->name ?? $unaccepted_row->license->category?->name ?? $unaccepted_row->category?->name ?? ''), | ||
model_plain: ($unaccepted_row->model?->name ?? $unaccepted_row->model_number ?? ''), | ||
name_plain: ($unaccepted_row->name ?? $unaccepted_row->license?->name ?? ''), | ||
company_plain: ($unaccepted_row->company)->name ?? $unaccepted_row->license->company?->name ?? '', | ||
); | ||
} | ||
} |
Godmartinz marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.