diff --git a/app/Http/Controllers/Accessories/AccessoriesController.php b/app/Http/Controllers/Accessories/AccessoriesController.php index fcfe89700..798c6b3ca 100755 --- a/app/Http/Controllers/Accessories/AccessoriesController.php +++ b/app/Http/Controllers/Accessories/AccessoriesController.php @@ -78,6 +78,8 @@ class AccessoriesController extends Controller $accessory->qty = request('qty'); $accessory->user_id = Auth::user()->id; $accessory->supplier_id = request('supplier_id'); + $accessory->notes = request('notes'); + $accessory = $request->handleImages($accessory); @@ -140,6 +142,7 @@ class AccessoriesController extends Controller $accessory->purchase_cost = Helper::ParseCurrency(request('purchase_cost')); $accessory->qty = request('qty'); $accessory->supplier_id = request('supplier_id'); + $accessory->notes = request('notes'); $accessory = $request->handleImages($accessory); diff --git a/app/Http/Controllers/Api/AccessoriesController.php b/app/Http/Controllers/Api/AccessoriesController.php index 5ff8622f4..23c555574 100644 --- a/app/Http/Controllers/Api/AccessoriesController.php +++ b/app/Http/Controllers/Api/AccessoriesController.php @@ -39,7 +39,8 @@ class AccessoriesController extends Controller 'notes', 'created_at', 'min_amt', - 'company_id' + 'company_id', + 'notes', ]; @@ -69,6 +70,10 @@ class AccessoriesController extends Controller $accessories->where('location_id','=',$request->input('location_id')); } + if ($request->filled('notes')) { + $accessories->where('notes','=',$request->input('notes')); + } + // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which // case we override with the actual count, so we should return 0 items. $offset = (($accessories) && ($request->get('offset') > $accessories->count())) ? $accessories->count() : $request->get('offset', 0); diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index 2bf6becb2..7f5d2b651 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -40,6 +40,7 @@ class ComponentsController extends Controller 'purchase_cost', 'qty', 'image', + 'notes', ]; @@ -62,6 +63,10 @@ class ComponentsController extends Controller $components->where('location_id','=',$request->input('location_id')); } + if ($request->filled('notes')) { + $components->where('notes','=',$request->input('notes')); + } + // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which // case we override with the actual count, so we should return 0 items. $offset = (($components) && ($request->get('offset') > $components->count())) ? $components->count() : $request->get('offset', 0); diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 913bc1bd5..369b7cb9c 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -42,6 +42,7 @@ class ConsumablesController extends Controller 'item_no', 'qty', 'image', + 'notes', ]; @@ -74,6 +75,10 @@ class ConsumablesController extends Controller $consumables->where('location_id','=',$request->input('location_id')); } + if ($request->filled('notes')) { + $consumables->where('notes','=',$request->input('notes')); + } + // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which // case we override with the actual count, so we should return 0 items. diff --git a/app/Http/Controllers/Components/ComponentsController.php b/app/Http/Controllers/Components/ComponentsController.php index e5e731edc..c90ead9aa 100644 --- a/app/Http/Controllers/Components/ComponentsController.php +++ b/app/Http/Controllers/Components/ComponentsController.php @@ -78,6 +78,7 @@ class ComponentsController extends Controller $component->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost', null)); $component->qty = $request->input('qty'); $component->user_id = Auth::id(); + $component->notes = $request->input('notes'); $component = $request->handleImages($component); @@ -147,6 +148,7 @@ class ComponentsController extends Controller $component->purchase_date = $request->input('purchase_date'); $component->purchase_cost = Helper::ParseCurrency(request('purchase_cost')); $component->qty = $request->input('qty'); + $component->notes = $request->input('notes'); $component = $request->handleImages($component); diff --git a/app/Http/Controllers/Consumables/ConsumablesController.php b/app/Http/Controllers/Consumables/ConsumablesController.php index 05e83a2a0..af0c4cd27 100644 --- a/app/Http/Controllers/Consumables/ConsumablesController.php +++ b/app/Http/Controllers/Consumables/ConsumablesController.php @@ -78,6 +78,8 @@ class ConsumablesController extends Controller $consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $consumable->qty = $request->input('qty'); $consumable->user_id = Auth::id(); + $consumable->notes = $request->input('notes'); + $consumable = $request->handleImages($consumable); @@ -143,6 +145,7 @@ class ConsumablesController extends Controller $consumable->purchase_date = $request->input('purchase_date'); $consumable->purchase_cost = Helper::ParseCurrency($request->input('purchase_cost')); $consumable->qty = Helper::ParseFloat($request->input('qty')); + $consumable->notes = $request->input('notes'); $consumable = $request->handleImages($consumable); diff --git a/app/Http/Transformers/ComponentsTransformer.php b/app/Http/Transformers/ComponentsTransformer.php index c27deb2a1..f215b9e47 100644 --- a/app/Http/Transformers/ComponentsTransformer.php +++ b/app/Http/Transformers/ComponentsTransformer.php @@ -43,6 +43,7 @@ class ComponentsTransformer 'id' => (int) $component->company->id, 'name' => e($component->company->name) ] : null, + 'notes' => ($component->notes) ? e($component->notes) : null, 'created_at' => Helper::getFormattedDateObject($component->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($component->updated_at, 'datetime'), 'user_can_checkout' => ($component->numRemaining() > 0) ? 1 : 0, diff --git a/app/Http/Transformers/ConsumablesTransformer.php b/app/Http/Transformers/ConsumablesTransformer.php index c82299de9..6cd8a99ce 100644 --- a/app/Http/Transformers/ConsumablesTransformer.php +++ b/app/Http/Transformers/ConsumablesTransformer.php @@ -37,6 +37,7 @@ class ConsumablesTransformer 'purchase_cost' => Helper::formatCurrencyOutput($consumable->purchase_cost), 'purchase_date' => Helper::getFormattedDateObject($consumable->purchase_date, 'date'), 'qty' => (int) $consumable->qty, + 'notes' => ($consumable->notes) ? e($consumable->notes) : null, 'created_at' => Helper::getFormattedDateObject($consumable->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($consumable->updated_at, 'datetime'), ]; diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index 1abac4f68..31735d63e 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -35,7 +35,7 @@ class Accessory extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'model_number', 'order_number', 'purchase_date']; + protected $searchableAttributes = ['name', 'model_number', 'order_number', 'purchase_date', 'notes']; /** * The relations and their attributes that should be included when searching the model. @@ -92,7 +92,8 @@ class Accessory extends SnipeModel 'image', 'qty', 'min_amt', - 'requestable' + 'requestable', + 'notes', ]; diff --git a/app/Models/Component.php b/app/Models/Component.php index 3e027cc4e..3e240078a 100644 --- a/app/Models/Component.php +++ b/app/Models/Component.php @@ -60,6 +60,7 @@ class Component extends SnipeModel 'order_number', 'qty', 'serial', + 'notes', ]; use Searchable; @@ -69,7 +70,7 @@ class Component extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'order_number', 'serial', 'purchase_cost', 'purchase_date']; + protected $searchableAttributes = ['name', 'order_number', 'serial', 'purchase_cost', 'purchase_date', 'notes']; /** * The relations and their attributes that should be included when searching the model. diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php index a2fcaed83..276ee9705 100644 --- a/app/Models/Consumable.php +++ b/app/Models/Consumable.php @@ -69,7 +69,8 @@ class Consumable extends SnipeModel 'purchase_date', 'qty', 'min_amt', - 'requestable' + 'requestable', + 'notes', ]; use Searchable; @@ -79,7 +80,7 @@ class Consumable extends SnipeModel * * @var array */ - protected $searchableAttributes = ['name', 'order_number', 'purchase_cost', 'purchase_date', 'item_no', 'model_number']; + protected $searchableAttributes = ['name', 'order_number', 'purchase_cost', 'purchase_date', 'item_no', 'model_number', 'notes']; /** * The relations and their attributes that should be included when searching the model. diff --git a/app/Presenters/AccessoryPresenter.php b/app/Presenters/AccessoryPresenter.php index bf7074ad5..311992c46 100644 --- a/app/Presenters/AccessoryPresenter.php +++ b/app/Presenters/AccessoryPresenter.php @@ -109,7 +109,14 @@ class AccessoryPresenter extends Presenter "sortable" => true, "visible" => false, "title" => trans('general.order_number'), - ],[ + ], [ + "field" => "notes", + "searchable" => true, + "sortable" => true, + "visible" => false, + "title" => trans('general.notes'), + "formatter" => "notesFormatter" + ], [ "field" => "change", "searchable" => false, "sortable" => false, diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php index 669b5c651..9ff2b3a93 100644 --- a/app/Presenters/ComponentPresenter.php +++ b/app/Presenters/ComponentPresenter.php @@ -104,7 +104,14 @@ class ComponentPresenter extends Presenter "title" => trans('general.purchase_cost'), "visible" => true, "footerFormatter" => 'sumFormatter', - ], + ], [ + "field" => "notes", + "searchable" => true, + "sortable" => true, + "visible" => false, + "title" => trans('general.notes'), + "formatter" => "notesFormatter" + ] ]; $layout[] = [ diff --git a/app/Presenters/ConsumablePresenter.php b/app/Presenters/ConsumablePresenter.php index 334398fab..047b09e58 100644 --- a/app/Presenters/ConsumablePresenter.php +++ b/app/Presenters/ConsumablePresenter.php @@ -118,13 +118,20 @@ class ConsumablePresenter extends Presenter "visible" => true, "footerFormatter" => 'sumFormatter', ],[ + "field" => "notes", + "searchable" => true, + "sortable" => true, + "visible" => false, + "title" => trans('general.notes'), + "formatter" => "notesFormatter" + ], [ "field" => "change", "searchable" => false, "sortable" => false, "visible" => true, "title" => trans('general.change'), "formatter" => "consumablesInOutFormatter", - ], [ + ], [ "field" => "actions", "searchable" => false, "sortable" => false, diff --git a/database/migrations/2022_03_03_225655_add_notes_to_accessories.php b/database/migrations/2022_03_03_225655_add_notes_to_accessories.php new file mode 100644 index 000000000..d6f8fac6f --- /dev/null +++ b/database/migrations/2022_03_03_225655_add_notes_to_accessories.php @@ -0,0 +1,34 @@ +text("notes")->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('accessories', function (Blueprint $table) { + if (Schema::hasColumn('accessories', 'notes')) { + $table->dropColumn('notes'); + } + }); + } +} diff --git a/database/migrations/2022_03_03_225754_add_notes_to_components.php b/database/migrations/2022_03_03_225754_add_notes_to_components.php new file mode 100644 index 000000000..2e0993097 --- /dev/null +++ b/database/migrations/2022_03_03_225754_add_notes_to_components.php @@ -0,0 +1,34 @@ +text("notes")->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('components', function (Blueprint $table) { + if (Schema::hasColumn('components', 'notes')) { + $table->dropColumn('notes'); + } + }); + } +} diff --git a/database/migrations/2022_03_03_225824_add_notes_to_consumables.php b/database/migrations/2022_03_03_225824_add_notes_to_consumables.php new file mode 100644 index 000000000..e024d6514 --- /dev/null +++ b/database/migrations/2022_03_03_225824_add_notes_to_consumables.php @@ -0,0 +1,34 @@ +text("notes")->nullable()->default(null); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('consumables', function (Blueprint $table) { + if (Schema::hasColumn('consumables', 'notes')) { + $table->dropColumn('notes'); + } + }); + } +} diff --git a/resources/views/accessories/edit.blade.php b/resources/views/accessories/edit.blade.php index 443a0b17c..d6233d4e5 100755 --- a/resources/views/accessories/edit.blade.php +++ b/resources/views/accessories/edit.blade.php @@ -35,6 +35,8 @@ @endif +@include ('partials.forms.edit.notes') + @include ('partials.forms.edit.image-upload') @stop diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 7241807cf..4d8f582f4 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -102,6 +102,20 @@ numRemaining() > 0 ) ? '' : ' disabled') }}>{{ trans('general.checkout') }} @endcan + + @if ($accessory->notes) + +