mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-12 00:24:07 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
83b906b153
|
@ -61,7 +61,7 @@ class LicenseCheckinController extends Controller
|
||||||
$license = License::find($licenseSeat->license_id);
|
$license = License::find($licenseSeat->license_id);
|
||||||
|
|
||||||
// LicenseSeat is not assigned, it can't be checked in
|
// LicenseSeat is not assigned, it can't be checked in
|
||||||
if (is_null($licenseSeat->assignedTo) && is_null($licenseSeat->asset_id)) {
|
if (is_null($licenseSeat->assigned_to) && is_null($licenseSeat->asset_id)) {
|
||||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkin.error'));
|
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkin.error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,36 @@ class LocationsController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a view that presents a form to clone a location.
|
||||||
|
*
|
||||||
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
|
* @param int $locationId
|
||||||
|
* @since [v6.0.14]
|
||||||
|
* @return View
|
||||||
|
*/
|
||||||
|
public function getClone($locationId = null)
|
||||||
|
{
|
||||||
|
$this->authorize('create', Location::class);
|
||||||
|
|
||||||
|
// Check if the asset exists
|
||||||
|
if (is_null($location_to_clone = Location::find($locationId))) {
|
||||||
|
// Redirect to the asset management page
|
||||||
|
return redirect()->route('licenses.index')->with('error', trans('admin/locations/message.does_not_exist'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$location = clone $location_to_clone;
|
||||||
|
|
||||||
|
// unset these values
|
||||||
|
$location->id = null;
|
||||||
|
$location->image = null;
|
||||||
|
|
||||||
|
return view('locations/edit')
|
||||||
|
->with('item', $location);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function print_all_assigned($id)
|
public function print_all_assigned($id)
|
||||||
{
|
{
|
||||||
if ($location = Location::where('id', $id)->first()) {
|
if ($location = Location::where('id', $id)->first()) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Http\Transformers;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ class LocationsTransformer
|
||||||
$permissions_array['available_actions'] = [
|
$permissions_array['available_actions'] = [
|
||||||
'update' => Gate::allows('update', Location::class) ? true : false,
|
'update' => Gate::allows('update', Location::class) ? true : false,
|
||||||
'delete' => $location->isDeletable(),
|
'delete' => $location->isDeletable(),
|
||||||
|
'clone' => (Gate::allows('create', Location::class) && ($location->deleted_at == '')),
|
||||||
];
|
];
|
||||||
|
|
||||||
$array += $permissions_array;
|
$array += $permissions_array;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th data-switchable="true" data-sortable="false" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
<th data-switchable="true" data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
|
||||||
<th data-switchable="true" data-sortable="true" data-field="name" data-formatter="groupsAdminLinkFormatter" data-visible="true">{{ trans('admin/groups/table.name') }}</th>
|
<th data-switchable="true" data-sortable="true" data-field="name" data-formatter="groupsAdminLinkFormatter" data-visible="true">{{ trans('admin/groups/table.name') }}</th>
|
||||||
<th data-switchable="true" data-sortable="true" data-field="users_count" data-visible="true">{{ trans('admin/groups/table.users') }}</th>
|
<th data-switchable="true" data-sortable="true" data-field="users_count" data-visible="true">{{ trans('admin/groups/table.users') }}</th>
|
||||||
<th data-switchable="true" data-sortable="true" data-field="created_at" data-visible="true" data-formatter="dateDisplayFormatter">{{ trans('general.created_at') }}</th>
|
<th data-switchable="true" data-sortable="true" data-field="created_at" data-visible="true" data-formatter="dateDisplayFormatter">{{ trans('general.created_at') }}</th>
|
||||||
|
|
|
@ -65,50 +65,3 @@
|
||||||
@include ('partials.forms.edit.image-upload')
|
@include ('partials.forms.edit.image-upload')
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@if (!$item->id)
|
|
||||||
@section('moar_scripts')
|
|
||||||
<script nonce="{{ csrf_token() }}">
|
|
||||||
|
|
||||||
var $eventSelect = $(".parent");
|
|
||||||
$eventSelect.on("change", function () { parent_details($eventSelect.val()); });
|
|
||||||
$(function() {
|
|
||||||
var parent_loc = $(".parent option:selected").val();
|
|
||||||
if(parent_loc!=''){
|
|
||||||
parent_details(parent_loc);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function parent_details(id) {
|
|
||||||
|
|
||||||
if (id) {
|
|
||||||
//start ajax request
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: "{{url('/') }}/api/locations/"+id+"/check",
|
|
||||||
//force to handle it as text
|
|
||||||
dataType: "text",
|
|
||||||
success: function(data) {
|
|
||||||
var json = $.parseJSON(data);
|
|
||||||
$("#city").val(json.city);
|
|
||||||
$("#address").val(json.address);
|
|
||||||
$("#address2").val(json.address2);
|
|
||||||
$("#state").val(json.state);
|
|
||||||
$("#zip").val(json.zip);
|
|
||||||
$(".country").select2("val",json.country);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$("#city").val('');
|
|
||||||
$("#address").val('');
|
|
||||||
$("#address2").val('');
|
|
||||||
$("#state").val('');
|
|
||||||
$("#zip").val('');
|
|
||||||
$(".country").select2("val",'');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@stop
|
|
||||||
@endif
|
|
||||||
|
|
|
@ -40,22 +40,36 @@ Route::group(['middleware' => 'auth'], function () {
|
||||||
'parameters' => ['category' => 'category_id'],
|
'parameters' => ['category' => 'category_id'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locations
|
* Locations
|
||||||
*/
|
*/
|
||||||
Route::resource('locations', LocationsController::class, [
|
|
||||||
'parameters' => ['location' => 'location_id'],
|
Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {
|
||||||
]);
|
|
||||||
|
Route::get('{locationId}/clone',
|
||||||
|
[LocationsController::class, 'getClone']
|
||||||
|
)->name('clone/license');
|
||||||
|
|
||||||
Route::get(
|
Route::get(
|
||||||
'locations/{locationId}/printassigned',
|
'{locationId}/printassigned',
|
||||||
[LocationsController::class, 'print_assigned']
|
[LocationsController::class, 'print_assigned']
|
||||||
)->name('locations.print_assigned');
|
)->name('locations.print_assigned');
|
||||||
|
|
||||||
Route::get(
|
Route::get(
|
||||||
'locations/{locationId}/printallassigned',
|
'{locationId}/printallassigned',
|
||||||
[LocationsController::class, 'print_all_assigned']
|
[LocationsController::class, 'print_all_assigned']
|
||||||
)->name('locations.print_all_assigned');
|
)->name('locations.print_all_assigned');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::resource('locations', LocationsController::class, [
|
||||||
|
'parameters' => ['location' => 'location_id'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Manufacturers
|
* Manufacturers
|
||||||
|
|
Loading…
Reference in a new issue