Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Helpers/IconHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static function icon($type) {
case 'more-files':
return 'fa-solid fa-laptop-file';
case 'maintenances':
return 'fas fa-wrench';
return 'fa-solid fa-screwdriver-wrench';
case 'seats':
return 'far fa-list-alt';
case 'globe-us':
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/MaintenancesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public function store(ImageUploadRequest $request) : RedirectResponse
{
$this->authorize('update', Asset::class);

\Log::error(print_r($request->input('selected_assets[]'), true));

if (!$request->filled('selected_assets')) {
return redirect()->back()->withInput()->with('error', 'No assets were selected.');
}

$assets = Asset::whereIn('id', $request->input('selected_assets'))->get();

// Loop through the selected assets
Expand Down
7 changes: 7 additions & 0 deletions app/Models/SnipeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ public function setPurchaseDateAttribute($value)
$this->attributes['purchase_date'] = $value;
}

protected function purchaseDateForDatepicker(): Attribute
{
return Attribute:: make(
get: fn(mixed $value, array $attributes) => array_key_exists('purchase_date', $attributes) ? Carbon::parse($attributes['purchase_date'])->format('Y-m-d') : null,
);
}


protected function purchaseDateFormatted(): Attribute
{
Expand Down
7 changes: 7 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Blade;

/**
* This service provider handles setting the observers on models
Expand All @@ -42,6 +43,9 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(UrlGenerator $url)
{



/**
* This is a workaround for proxies/reverse proxies that don't always pass the proper headers.
*
Expand Down Expand Up @@ -76,6 +80,9 @@ public function boot(UrlGenerator $url)
Consumable::observe(ConsumableObserver::class);
License::observe(LicenseObserver::class);
Setting::observe(SettingObserver::class);

// https://laravel.com/docs/11.x/blade#html-entity-encoding
Blade::withoutDoubleEncoding();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely need to check this and make sure it won't introduce XSS issues, etc.

}

/**
Expand Down
2 changes: 1 addition & 1 deletion public/css/build/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/build/app.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/build/overrides.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/build/overrides.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/dist/all.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"/js/dist/all.js": "/js/dist/all.js?id=6ffdb46d7dcfceb395f453e15cfbc4be",
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=bf1a348eae3e60c62b8879953f7df14c",
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=f712d11cfca345b58c1d8a35df03d38d",
"/css/build/overrides.css": "/css/build/overrides.css?id=f9623ce518286374061ab2e687625d44",
"/css/build/app.css": "/css/build/app.css?id=83eea8dd4d4fca629261df8b71025a77",
"/css/build/overrides.css": "/css/build/overrides.css?id=3a3b20a7cde391756b707a67a3e297e4",
"/css/build/app.css": "/css/build/app.css?id=86244e556cc26877415e9ab63e8b7e33",
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=bdf169bc2141f453390614c138cdce95",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=e1e6e1c64cf14fc350585aaeb0e42f6b",
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=08ae1b3e66008966ce5d600ea3ad04a2",
Expand All @@ -19,7 +19,7 @@
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=68a92d85c8e351dfb38a835307f126ec",
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=cbb20ad6182b658f34117bf96a621b63",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=84e2ee950ae04444988b37038e5a3951",
"/css/dist/all.css": "/css/dist/all.css?id=b234d09cc37cdddb008d79d2a1f46660",
"/css/dist/all.css": "/css/dist/all.css?id=d025bd7724d6b3510b3818f6f120f6ef",
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",
Expand Down
4 changes: 0 additions & 4 deletions resources/assets/less/overrides.less
Original file line number Diff line number Diff line change
Expand Up @@ -1175,10 +1175,6 @@ input[type="radio"]:checked::before {
display: table-row !important;
}

.form-control-static {
padding-top: 0px;
}


td.text-right.text-padding-number-cell {
padding-right: 30px !important;
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en-US/admin/asset_maintenances/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'select_type' => 'Select Maintenance Type',
'asset_maintenance_type' => 'Asset Maintenance Type',
'asset_maintenance_type' => 'Maintenance Type',
'title' => 'Title',
'start_date' => 'Start Date',
'completion_date' => 'Completion Date',
Expand Down
47 changes: 47 additions & 0 deletions resources/views/blade/box.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@props([
'item' => null,
'border_class' => 'default',
'header_icon' => null,
'form_route' => null,
])



<div {{ $attributes->merge(['class' => 'col-lg-6 col-lg-offset-3 col-md-10 col-md-offset-1 col-sm-12 col-sm-offset-0']) }}>


<!-- CSRF Token -->
{{ csrf_field() }}

<div class="box box-{{ $border_class }}">

<!-- .box-header -->
<div class="box-header with-border">
<h2 class="box-title">
@if ($header_icon)
<x-icon type="{{ $header_icon }}" class="box-header-icon" />
@endif
{{ ($item->id) ? $item->display_name : trans('general.create') }}
</h2>
</div>
<!-- /.box-header -->

<!-- box-body -->
<div class="box-body">

{{ $slot }}

</div>
<!-- /.box-body -->

<div class="box-footer text-right">
<button type="submit" class="btn btn-success">
<x-icon type="checkmark" />
{{ trans('general.save') }}
</button>
</div>
<!-- /.box-footer -->

</div> <!-- /.box-default -->

</div>
7 changes: 7 additions & 0 deletions resources/views/blade/form-inline-help-text.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- Help Text -->
<div {{ $attributes->merge(['class' => 'col-md-8 col-md-offset-3']) }}>
<p class="help-block">
{{ $slot }}
</p>
</div>

7 changes: 7 additions & 0 deletions resources/views/blade/form-inline-tooltip.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

<!-- Info Tooltip -->
<div class="col-md-1 text-left" style="padding-left:0; margin-top: 5px;">
<x-form-tooltip>
{{ $slot }}
</x-form-tooltip>
</div>
71 changes: 71 additions & 0 deletions resources/views/blade/form-input.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@aware(['name'])

@props([
'class' => null,
'new_model' => false,
'category_type' => null,
'modal_type' => false,
'modal_id' => false,
])

<?php

// Let's set some sane defaults here for smaller fields
// This uses the form name to determine the appropriate class
switch ($name) {
case 'qty':
case 'min_amt':
case 'seats':
$class_override = $new_model ? 'col-md-3' : 'col-md-4';
break;
case 'purchase_cost':
case 'purchase_date':
case 'termination_date':
case 'expiration_date':
case 'start_date':
case 'end_date':
$class_override = $new_model ? 'col-md-4' : 'col-md-5';
break;
case 'model_number':
case 'item_no':
case 'order_number':
case 'purchase_order':
$class_override = $new_model ? 'col-md-5' : 'col-md-6';
break;
default:
$class_override = $new_model ? 'col-md-7' : 'col-md-8';
break;
}

// Use the explicit override if one is set
if ($class) {
$class_override = $class;
}
?>
<!-- form-input blade component -->
<div {{ $attributes->merge(['class' => $class_override]) }}>
{{ $slot }}
</div>

@if ($new_model)
<div class="col-md-1 col-sm-1">
@can('create', $new_model)
<a href='{{ route('modal.show',[
'type' => $modal_type ?? null,
'category_type' => $category_type ?? null
]) }}' data-toggle="modal" data-target="#createModal" data-select="{{ $modal_id }}" class="btn btn-sm btn-primary text-left">{{ trans('button.new') }}</a>
@endcan
</div>
@endif


@error($name)
<div class="col-md-8 col-md-offset-3">
<span class="alert-msg" aria-hidden="true">
<x-icon type="x" />
{{ $message }}
</span>
</div>


@enderror
4 changes: 3 additions & 1 deletion resources/views/blade/form-label.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@aware(['name'])

<!-- form-label blade component -->
<label {{ $attributes->merge(['class' => 'control-label']) }}>
<label {{ $attributes->merge(['class' => 'control-label col-md-3']) }} for="{{ $name }}">
{{ $slot }}
</label>
75 changes: 4 additions & 71 deletions resources/views/blade/form-row.blade.php
Original file line number Diff line number Diff line change
@@ -1,76 +1,9 @@
<!-- form-row blade component -->
@props([
'name' => null,
'type' => 'text',
'item' => null,
'info_tooltip_text' => null,
'help_text' => null,
'label' => null,
'input_div_class' => 'col-md-8',
'errors_class' => $errors->has('support_url') ? ' has-error' : '',
'input_icon' => null,
'input_group_addon' => null,
'rows' => null,
'placeholder' => null,
])

<div {{ $attributes->merge(['class' => 'form-group'. $errors_class]) }}>

<!-- form label -->
@if (isset($label))
<x-form-label :for="$name" class="{{ $label_class ?? 'col-md-3' }}">{{ $label }}</x-form-label>
@endif


@php
$blade_type = in_array($type, ['text', 'email', 'url', 'tel', 'number', 'password']) ? 'text' : $type;
@endphp

<div class="{{ $input_div_class }}">
<x-dynamic-component
:$name
:$type
:aria-label="$name"
:component="'input.'.$blade_type"
:id="$name"
:required="Helper::checkIfRequired($item, $name)"
:value="old($name, $item->{$name})"
:input_icon="$input_icon"
:input_group_addon="$input_group_addon"
:rows="$rows"
:placeholder="$placeholder"

/>
</div>

@if ($info_tooltip_text)
<!-- Info Tooltip -->
<div class="col-md-1 text-left" style="padding-left:0; margin-top: 5px;">
<x-form-tooltip>
{{ $info_tooltip_text }}
</x-form-tooltip>
</div>
@endif


@error($name)
<div class="col-md-8 col-md-offset-3">
<span class="alert-msg" aria-hidden="true">
<x-icon type="x" />
{{ $message }}
</span>
</div>
@enderror

@if ($help_text)
<!-- Help Text -->
<div class="col-md-8 col-md-offset-3">
<p class="help-block">
{!! $help_text !!}
</p>
</div>
@endif


<!-- form-row blade component -->
<div {{ $attributes->merge(['name' => $name]) }} class="form-group @error($name) has-error @enderror">
{{ $slot }}
</div>

</div>
15 changes: 15 additions & 0 deletions resources/views/blade/form.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@props([
'item' => null,
'update_route' => null,
'create_route' => null,
])

<form class="form-horizontal" id="create-form" method="post" action="{{ ($item->id) ? route($update_route, $item->id) : route($create_route) }}" autocomplete="off" enctype="multipart/form-data">

@if ($item->id)
{{ method_field('PUT') }}
@endif

{{ $slot }}

</form>
28 changes: 23 additions & 5 deletions resources/views/blade/input/datepicker.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
@aware(['name'])

@props([
'value' => '',
'required' => '',
'value' => null,
'required' => false,
'end_date' => null,
'col_size_class' => null,
'name' => null,
])

<!-- Datepicker -->
<div class="input-group date {{ $col_size_class }}" data-provide="datepicker" data-date-today-highlight="true" data-date-language="{{ auth()->user()->locale }}" data-date-locale="{{ auth()->user()->locale }}" data-date-format="yyyy-mm-dd" data-date-autoclose="true" data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}>
<input type="text" placeholder="{{ trans('general.select_date') }}" value="{{ $value }}" maxlength="10" {{ $attributes->merge(['class' => 'form-control']) }} {{ $required=='1' ? 'required' : '' }}>
<div
{{ $attributes->merge(['class' => 'input-group date']) }}
data-provide="datepicker"
data-date-today-highlight="true"
data-date-language="{{ auth()->user()->locale }}"
data-date-locale="{{ auth()->user()->locale }}"
data-date-format="yyyy-mm-dd"
data-date-autoclose="true"
data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}>

<input
type="text"
name="{{ $name }}"
placeholder="{{ trans('general.select_date') }}"
value="{{ $value }}" maxlength="10"
{{ $attributes->merge(['class' => 'form-control']) }}
{{ $required ? ' required' : '' }}
>
<span class="input-group-addon"><x-icon type="calendar" /></span>

</div>
Loading
Loading