Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe
2026-03-10 09:54:08 +00:00
14 changed files with 98 additions and 92 deletions

View File

@@ -46,13 +46,13 @@ jobs:
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
# https://github.com/docker/login-action
- name: Login to DockerHub
# Only login if not a PR, as PRs only trigger a Docker build and not a push
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
# Get Metadata for docker_build step below
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
id: meta_build
uses: docker/metadata-action@v5
uses: docker/metadata-action@v6
with:
images: snipe/snipe-it
tags: ${{ env.IMAGE_TAGS }}
@@ -73,7 +73,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push 'snipe-it' image
id: docker_build
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.alpine

View File

@@ -46,13 +46,13 @@ jobs:
# https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
# https://github.com/docker/login-action
- name: Login to DockerHub
# Only login if not a PR, as PRs only trigger a Docker build and not a push
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
@@ -64,7 +64,7 @@ jobs:
# Get Metadata for docker_build step below
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
id: meta_build
uses: docker/metadata-action@v5
uses: docker/metadata-action@v6
with:
images: snipe/snipe-it
tags: ${{ env.IMAGE_TAGS }}
@@ -73,7 +73,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push 'snipe-it' image
id: docker_build
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile

View File

@@ -1149,7 +1149,7 @@ class AssetsController extends Controller
'id' => $asset->id,
'asset_tag' => $asset->asset_tag,
'note' => e($request->input('note')),
'status_label' => e($asset->assetstatus->display_name),
'status_label' => e($asset->assetstatus?->display_name),
'status_type' => $asset->assetstatus->getStatuslabelType(),
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date),
];

View File

@@ -91,7 +91,7 @@ class ComponentsTransformer
'id' => (int) $asset->id,
'name' => e($asset->model->display_name).' '.e($asset->display_name),
'qty' => $asset->pivot->assigned_qty,
'note' => $asset->pivot->note,
'note' => e($asset->pivot->note),
'type' => 'asset',
'created_at' => Helper::getFormattedDateObject($asset->pivot->created_at, 'datetime'),
'available_actions' => ['checkin' => true],

View File

@@ -3,42 +3,6 @@
* Macro helpers
*/
/**
* Country macro
* Generates the dropdown menu of countries for the profile form
*/
Form::macro('countries', function ($name = 'country', $selected = null, $class = null, $id = null) {
$idclause = (!is_null($id)) ? $id : '';
// Pull the autoglossonym array from the localizations translation file
$countries_array = trans('localizations.countries');
$select = '<select name="'.$name.'" class="'.$class.'" style="width:100%" '.$idclause.' aria-label="'.$name.'" data-placeholder="'.trans('localizations.select_country').'" data-allow-clear="true" data-tags="true">';
$select .= '<option value="" role="option">'.trans('localizations.select_country').'</option>';
foreach ($countries_array as $abbr => $country) {
// We have to handle it this way to handle deprecation warnings since you can't strtoupper on null
if ($abbr!='') {
$abbr = strtoupper($abbr);
}
// Loop through the countries configured in the localization file
$select .= '<option value="' . $abbr . '" role="option" ' . (($selected == $abbr) ? ' selected="selected" aria-selected="true"' : ' aria-selected="false"') . '>' . $country . '</option> ';
}
// If the country value doesn't exist in the array, add it as a new option and select it so we don't drop that data
if (!array_key_exists($selected, $countries_array)) {
$select .= '<option value="' . e($selected) . '" selected="selected" role="option" aria-selected="true">' . e($selected) .' *</option> ';
}
$select .= '</select>';
return $select;
});
/**
* Barcode macro
* Generates the dropdown menu of available 1D barcodes
@@ -85,29 +49,3 @@ Form::macro('barcode_types', function ($name = 'barcode_type', $selected = null,
return $select;
});
Form::macro('username_format', function ($name = 'username_format', $selected = null, $class = null) {
$formats = [
'firstname.lastname' => trans('admin/settings/general.username_formats.firstname_lastname_format'),
'firstname' => trans('admin/settings/general.username_formats.first_name_format'),
'lastname' => trans('admin/settings/general.username_formats.last_name_format'),
'filastname' => trans('admin/settings/general.username_formats.filastname_format'),
'lastnamefirstinitial' => trans('admin/settings/general.username_formats.lastnamefirstinitial_format'),
'firstname_lastname' => trans('admin/settings/general.username_formats.firstname_lastname_underscore_format'),
'firstinitial.lastname' => trans('admin/settings/general.username_formats.firstinitial_lastname'),
'lastname_firstinitial' => trans('admin/settings/general.username_formats.lastname_firstinitial'),
'lastname.firstinitial' => trans('admin/settings/general.username_formats.lastname_dot_firstinitial_format'),
'firstnamelastname' => trans('admin/settings/general.username_formats.firstnamelastname'),
'firstnamelastinitial' => trans('admin/settings/general.username_formats.firstnamelastinitial'),
'lastname.firstname' => trans('admin/settings/general.username_formats.lastnamefirstname'),
];
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
foreach ($formats as $format => $label) {
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
}
$select .= '</select>';
return $select;
});

View File

@@ -0,0 +1,35 @@
@props([
'name' => 'country',
'selected' => null,
])
@php
$countries_array = trans('localizations.countries');
@endphp
<select
name="{{ $name }}"
{{ $attributes->merge(['class' => 'select2']) }}
aria-label="{{ $name }}"
data-placeholder="{{ trans('localizations.select_country') }}"
data-allow-clear="true"
>
@foreach($countries_array as $abbreviation => $country)
@php
// We have to handle it this way to handle deprecation warnings since you can't strtoupper on null
if ($abbreviation!='') {
$abbreviation = strtoupper($abbreviation);
}
@endphp
<option value="{{ $abbreviation }}" {{ $selected === $abbreviation ? 'selected' : '' }}>
{{ $country }}
</option>
@endforeach
{{-- If the country value doesn't exist in the array, add it as a new option and select it so we don't drop that data --}}
@if (!array_key_exists($selected, $countries_array)) {
<option value="{{ e($selected) }}" selected="selected" role="option" aria-selected="true"> {{ e($selected) }} *</option> ';
@endif
</select>

View File

@@ -0,0 +1,27 @@
@php
$formats = [
'firstname.lastname' => trans('admin/settings/general.username_formats.firstname_lastname_format'),
'firstname' => trans('admin/settings/general.username_formats.first_name_format'),
'lastname' => trans('admin/settings/general.username_formats.last_name_format'),
'filastname' => trans('admin/settings/general.username_formats.filastname_format'),
'lastnamefirstinitial' => trans('admin/settings/general.username_formats.lastnamefirstinitial_format'),
'firstname_lastname' => trans('admin/settings/general.username_formats.firstname_lastname_underscore_format'),
'firstinitial.lastname' => trans('admin/settings/general.username_formats.firstinitial_lastname'),
'lastname_firstinitial' => trans('admin/settings/general.username_formats.lastname_firstinitial'),
'lastname.firstinitial' => trans('admin/settings/general.username_formats.lastname_dot_firstinitial_format'),
'firstnamelastname' => trans('admin/settings/general.username_formats.firstnamelastname'),
'firstnamelastinitial' => trans('admin/settings/general.username_formats.firstnamelastinitial'),
'lastname.firstname' => trans('admin/settings/general.username_formats.lastnamefirstname'),
];
@endphp
<x-input.select {{ $attributes }}>
@foreach($formats as $format => $label)
<option
value="{{ $format }}"
@selected($selected == $format)
>
{{ $label }}
</option>
@endforeach
</x-input.select>

View File

@@ -158,7 +158,7 @@
if (data.status == 'success') {
$('#audited tbody').prepend("<tr class='success'><td>" + data.payload.asset_tag + "</td><td>" + data.messages + "</td><td>" + data.payload.status_label + " (" + data.payload.status_type + ")</td><td>" + data.payload.note + "</td><td><i class='fas fa-check text-success' style='font-size:18px;'></i></td></tr>");
@if ($user->enable_sounds)
@if ($user?->enable_sounds)
var audio = new Audio('{{ config('app.url') }}/sounds/success.mp3');
audio.play()
@endif
@@ -182,7 +182,7 @@
});
function handleAuditFail (data, asset_tag) {
@if ($user->enable_sounds)
@if ($user?->enable_sounds)
var audio = new Audio('{{ config('app.url') }}/sounds/error.mp3');
audio.play()
@endif

View File

@@ -32,7 +32,13 @@
<div class="dynamic-form-row">
<div class="col-md-3 col-xs-12 country"><label for="modal-country">{{ trans('general.country') }}:</label></div>
<div class="col-md-9 col-xs-12">{!! Form::countries('country', old('country'), 'select2 country',"modal-country") !!}</div>
<div class="col-md-9 col-xs-12">
<x-input.country-select
name="country"
:selected="old('country')"
id="modal-country"
/>
</div>
</div>
</form>
</div>

View File

@@ -46,7 +46,7 @@
</div> <!-- /.modal-body-->
<div class="modal-footer">
<a href="#" class="pull-left" data-dismiss="modal">{{ trans('button.cancel') }}</a>
<button type="submit" class="btn btn-theme">{{ trans('button.upload') }}</button>
<button type="button" class="btn btn-theme" formnovalidate>{{ trans('button.upload') }}</button>
</div>
</form>
</div>

View File

@@ -34,7 +34,10 @@
<div class="form-group {{ $errors->has('country') ? ' has-error' : '' }}">
<label for="country" class="col-md-3 control-label">{{ trans('general.country') }}</label>
<div class="col-md-7">
{!! Form::countries('country', old('country', $item->country), 'select2') !!}
<x-input.country-select
name="country"
:selected="old('country', $item->country)"
/>
<p class="help-block">{{ trans('general.countries_manually_entered_help') }}</p>
{!! $errors->first('country', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>

View File

@@ -102,7 +102,12 @@
<label for="username_format" class="col-md-3 control-label">{{ trans('admin/settings/general.username_formats.username_format') }}</label>
<div class="col-md-8">
{!! Form::username_format('username_format', old('username_format', $setting->username_format), 'select2') !!}
<x-input.username-select
name="username_format"
:selected="old('username_format', $setting->username_format)"
style="width: 100%"
aria-label="username_format"
/>
{!! $errors->first('username_format', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">

View File

@@ -80,19 +80,7 @@
<!-- start components tab pane -->
@can('view', \App\Models\Component::class)
<x-tabs.pane name="components" class="{{ $supplier->components->count() == 0 ? 'hidden-print' : '' }}">
<x-slot:header>
{{ trans('general.components') }}
</x-slot:header>
<x-table
show_advanced_search="true"
buttons="componentButtons"
api_url="{{ route('api.components.index', ['supplier_id' => $supplier->id]) }}"
:presenter="\App\Presenters\ComponentPresenter::dataTableLayout()"
export_filename="export-{{ str_slug($supplier->name) }}-components-{{ date('Y-m-d') }}"
/>
<x-table.components name="components" :route="route('api.components.index', ['supplier_id' => $supplier->id])" />
</x-tabs.pane>
@endcan
<!-- end components tab pane -->

View File

@@ -502,7 +502,11 @@
<div class="form-group{{ $errors->has('country') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="country">{{ trans('general.country') }}</label>
<div class="col-md-6">
{!! Form::countries('country', old('country', $user->country), 'col-md-12 select2') !!}
<x-input.country-select
name="country"
:selected="old('country', $user->country)"
class="col-md-12"
/>
<p class="help-block">{{ trans('general.countries_manually_entered_help') }}</p>
{!! $errors->first('country', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}