Skip to content

A free open source IT asset/license management system

Added notes

snipe66cab56c4795
diff --git a/resources/views/maintenances/view.blade.php b/resources/views/maintenances/view.blade.php
index 64eaa31a30..6fe8614552 100644
--- a/resources/views/maintenances/view.blade.php
+++ b/resources/views/maintenances/view.blade.php
@@ -21,6 +21,7 @@ use Carbon\Carbon;
<x-tabs>
<x-slot:tabnav>
<x-tabs.details-tab/>
+ <x-tabs.note-tab :item="$maintenance" count="{{ $maintenance->journal->count() }}"/>
<x-tabs.files-tab :item="$maintenance" count="{{ $maintenance->uploads()->count() }}"/>
<x-tabs.history-tab count="{{ $maintenance->history()->count() }}" :model="$maintenance"/>
<x-tabs.upload-tab :item="$maintenance"/>
@@ -103,7 +104,7 @@ use Carbon\Carbon;
{{ $snipeSettings->default_currency .' '. Helper::formatCurrencyOutput($maintenance->cost) }}
</x-data-row>
- <x-data-row :label="trans('admin/maintenances/form.is_warranty')" copy_what="warranty_improvement">
+ <x-data-row :label="trans('admin/maintenances/form.is_warranty')">
@if ($maintenance->is_warranty=='1')
<x-icon type="checkmark" class="text-success"/>
{{ trans('general.yes') }}
@@ -191,6 +192,15 @@ use Carbon\Carbon;
<x-table.files object_type="maintenances" :object="$maintenance"/>
</x-tabs.pane>
+ <x-tabs.pane name="notes">
+ <x-table.history
+ :table_header="trans('general.notes')"
+ :model="$maintenance"
+ :route="route('api.activity.index', ['item_id' => $maintenance->id, 'item_type' => 'maintenance', 'action_type' => 'note added'])"
+ :hide_fields="['id','action_type', 'item', 'changed', 'target','file','file_download','quantity','changed','serial','signature_file','log_meta']"
+ />
+ </x-tabs.pane>
+
<x-tabs.pane name="history">
<x-table.history :model="$maintenance" :route="route('api.maintenances.history', $maintenance)"/>
</x-tabs.pane>
@@ -206,15 +216,13 @@ use Carbon\Carbon;
<x-slot:buttons>
<x-button.edit :item="$maintenance" :route="route('maintenances.edit', $maintenance->id)" />
+ <x-button.note :item="$maintenance"/>
@if (! $maintenance->completed_at)
@can('update', $maintenance->asset)
- <form method="POST" action="{{ route('maintenances.complete', $maintenance->id) }}" style="display:inline;">
- @csrf
- <button type="submit" class="btn btn-success btn-sm" data-tooltip="true" title="{{ trans('admin/maintenances/form.mark_complete') }}">
- <x-icon type="checkmark" class="fa-fw"/>
- <span class="sr-only">{{ trans('admin/maintenances/form.mark_complete') }}</span>
- </button>
- </form>
+ <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#completeMaintenanceModal" data-tooltip="true" title="{{ trans('admin/maintenances/form.mark_complete') }}">
+ <x-icon type="checkmark" class="fa-fw"/>
+ <span class="sr-only">{{ trans('admin/maintenances/form.mark_complete') }}</span>
+ </button>
@endcan
@else
<span class="btn btn-sm btn-default disabled" data-tooltip="true" title="{{ trans('admin/maintenances/form.already_complete') }}: {{ Helper::getFormattedDateObject($maintenance->completed_at, 'datetime', false) }}">
@@ -237,6 +245,35 @@ use Carbon\Carbon;
@can('files', $maintenance)
@include ('modals.upload-file', ['item_type' => 'maintenances', 'item_id' => $maintenance->id])
@endcan
+ @can('journal', $maintenance)
+ @include ('modals.add-note', ['type' => 'maintenance', 'id' => $maintenance->id])
+ @endcan
+
+ <div class="modal fade" id="completeMaintenanceModal" tabindex="-1" role="dialog" aria-labelledby="completeMaintenanceModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('button.close') }}">
+ <span aria-hidden="true">&times;</span></button>
+ <h4 class="modal-title" id="completeMaintenanceModalLabel">{{ trans('admin/maintenances/form.mark_complete') }}</h4>
+ </div>
+ <form method="POST" action="{{ route('maintenances.complete', $maintenance->id) }}">
+ @csrf
+ <div class="modal-body">
+ <p>{{ trans('admin/maintenances/message.complete.confirm') }}</p>
+ <div class="form-group">
+ <label for="completionNote">{{ trans('admin/maintenances/form.completion_notes') }}</label>
+ <textarea class="form-control" id="completionNote" name="note" rows="3"></textarea>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default pull-left" data-dismiss="modal">{{ trans('button.cancel') }}</button>
+ <button type="submit" class="btn btn-success pull-right">{{ trans('admin/maintenances/form.mark_complete') }}</button>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
@include ('partials.bootstrap-table')
@endsection
diff --git a/routes/api.php b/routes/api.php
index 5fe546edc3..3a128527c2 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -625,6 +625,14 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'api-throttle:api']], fu
]
)->name('api.maintenances.history')->withTrashed();
+ Route::get('/maintenances/{maintenance}/notes',
+ [Api\MaintenancesController::class, 'notesIndex']
+ )->name('api.maintenances.notes.index');
+
+ Route::post('/maintenances/{maintenance}/notes',
+ [Api\MaintenancesController::class, 'notesStore']
+ )->name('api.maintenances.notes.store');
+
Route::post('/maintenances/{maintenance}/complete',
[Api\MaintenancesController::class, 'complete']
)->name('api.maintenances.complete');