Compare commits
117 Commits
#18172-bet
...
v8.3.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58a47cb52b | ||
|
|
c7cb4674f5 | ||
|
|
523df21d83 | ||
|
|
82314076a9 | ||
|
|
d04bf2e8f2 | ||
|
|
a1c67b5154 | ||
|
|
3e343fe8b7 | ||
|
|
e288c942ee | ||
|
|
7a1ccb0d53 | ||
|
|
89656c7e65 | ||
|
|
7f76198139 | ||
|
|
5ff813f9b7 | ||
|
|
69994e0c11 | ||
|
|
aa959fbe92 | ||
|
|
948b7cda15 | ||
|
|
644ef040d0 | ||
|
|
33839d7244 | ||
|
|
48270cb9b4 | ||
|
|
cd42760b68 | ||
|
|
1116da389e | ||
|
|
24d7ae4a2f | ||
|
|
e598ef6e05 | ||
|
|
6601e73069 | ||
|
|
7f2a80552b | ||
|
|
eceeb4aa3b | ||
|
|
b5c7f374f3 | ||
|
|
9d08e2d297 | ||
|
|
f2303ae2dc | ||
|
|
4d44fd47c3 | ||
|
|
88635cb6c3 | ||
|
|
1687fcc035 | ||
|
|
39e7937458 | ||
|
|
60ff2970f0 | ||
|
|
212cd026a3 | ||
|
|
cf47f8fea9 | ||
|
|
4b45ffd841 | ||
|
|
69a57b77c9 | ||
|
|
5daba6034d | ||
|
|
4e5c19e932 | ||
|
|
5eb73baf5e | ||
|
|
d819f31bdd | ||
|
|
a97c453706 | ||
|
|
5ee955a713 | ||
|
|
57224f7304 | ||
|
|
270d145466 | ||
|
|
c564ee6093 | ||
|
|
caaa9ab23e | ||
|
|
b6d2c6d28c | ||
|
|
c36c8968d3 | ||
|
|
b019af1851 | ||
|
|
bcd32da2bc | ||
|
|
6f97a40372 | ||
|
|
c56c7ddd03 | ||
|
|
9a0dd604c9 | ||
|
|
a1dec176a1 | ||
|
|
67032d068d | ||
|
|
401c83945d | ||
|
|
ed6d020edb | ||
|
|
8eb5600b1e | ||
|
|
9c4cd69106 | ||
|
|
64cbe0c960 | ||
|
|
be70b217d9 | ||
|
|
b4f5260dda | ||
|
|
83e446f99c | ||
|
|
767139cf0b | ||
|
|
e3ac60111f | ||
|
|
c694c11724 | ||
|
|
b50765a151 | ||
|
|
590f77bdb4 | ||
|
|
09575e5312 | ||
|
|
1693825dd0 | ||
|
|
5a89056112 | ||
|
|
2ee51bb282 | ||
|
|
ea7cffc1a3 | ||
|
|
c20d1b82ae | ||
|
|
607781382f | ||
|
|
4e8c1e853b | ||
|
|
2c6869501e | ||
|
|
4509e1d1dc | ||
|
|
6b9d4941be | ||
|
|
308cd6b91d | ||
|
|
23b54de8bd | ||
|
|
bd742aec9c | ||
|
|
d2ab3071a6 | ||
|
|
1dd4c161f0 | ||
|
|
5e48dd45b2 | ||
|
|
601d6e7377 | ||
|
|
3934b40282 | ||
|
|
d43be271e6 | ||
|
|
d3c9963051 | ||
|
|
92a3bdf4e9 | ||
|
|
fa2aafe41f | ||
|
|
bc5da2532c | ||
|
|
a7be1acbd8 | ||
|
|
fbe2ae03ff | ||
|
|
d1a492f953 | ||
|
|
ac6ea8bdcc | ||
|
|
352807c2d7 | ||
|
|
dc4cf8496a | ||
|
|
ed79d21e1b | ||
|
|
743d340bca | ||
|
|
3d1398ab97 | ||
|
|
7a680ce4ff | ||
|
|
2ac4456f4e | ||
|
|
391aa30da2 | ||
|
|
f92f76b48a | ||
|
|
61b6d4dc47 | ||
|
|
aa041e39eb | ||
|
|
723abca34a | ||
|
|
32b28327e9 | ||
|
|
c30131275f | ||
|
|
56218dfcb2 | ||
|
|
0d2a75db0a | ||
|
|
eb9d066844 | ||
|
|
029f3030a7 | ||
|
|
8c59a8d405 | ||
|
|
6904ad02a2 |
@@ -197,7 +197,7 @@ REPORT_TIME_LIMIT=12000
|
||||
API_THROTTLE_PER_MINUTE=120
|
||||
CSV_ESCAPE_FORMULAS=true
|
||||
LIVEWIRE_URL_PREFIX=null
|
||||
|
||||
MAX_UNPAGINATED=5000
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: SAML SETTINGS
|
||||
|
||||
2
.github/workflows/SA-codeql.yml
vendored
2
.github/workflows/SA-codeql.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
language: [ 'javascript' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
2
.github/workflows/codacy-analysis.yml
vendored
2
.github/workflows/codacy-analysis.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
|
||||
2
.github/workflows/crowdin-upload.yml
vendored
2
.github/workflows/crowdin-upload.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Crowdin push
|
||||
uses: crowdin/github-action@v2
|
||||
|
||||
2
.github/workflows/docker-alpine.yml
vendored
2
.github/workflows/docker-alpine.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
|
||||
2
.github/workflows/docker-ubuntu.yml
vendored
2
.github/workflows/docker-ubuntu.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
|
||||
2
.github/workflows/dockerhub-description.yml
vendored
2
.github/workflows/dockerhub-description.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Docker Hub Description
|
||||
uses: grokability/dockerhub-description@7ea9d275c7cdbe2b676a093a0308c50665e3b8b4
|
||||
|
||||
2
.github/workflows/tests-mysql.yml
vendored
2
.github/workflows/tests-mysql.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
2
.github/workflows/tests-postgres.yml
vendored
2
.github/workflows/tests-postgres.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
2
.github/workflows/tests-sqlite.yml
vendored
2
.github/workflows/tests-sqlite.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
@@ -9,6 +9,8 @@ use App\Notifications\ExpectedCheckinAdminNotification;
|
||||
use App\Notifications\ExpectedCheckinNotification;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use App\Helpers\Helper;
|
||||
|
||||
class SendExpectedCheckinAlerts extends Command
|
||||
{
|
||||
@@ -17,7 +19,7 @@ class SendExpectedCheckinAlerts extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'snipeit:expected-checkin';
|
||||
protected $signature = 'snipeit:expected-checkin {--with-output : Display the results in a table in your console in addition to sending the email}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -42,19 +44,47 @@ class SendExpectedCheckinAlerts extends Command
|
||||
public function handle()
|
||||
{
|
||||
$settings = Setting::getSettings();
|
||||
$interval = $settings->audit_warning_days ?? 0;
|
||||
$interval = $settings->due_checkin_days ?? 0;
|
||||
$today = Carbon::now();
|
||||
$interval_date = $today->copy()->addDays($interval);
|
||||
|
||||
$count = 0;
|
||||
|
||||
if (!$this->option('with-output')) {
|
||||
$this->info('Run this command with the --with-output option to see the full list in the console.');
|
||||
}
|
||||
|
||||
$assets = Asset::whereNull('deleted_at')->DueOrOverdueForCheckin($settings)->orderBy('assets.expected_checkin', 'desc')->get();
|
||||
|
||||
$this->info($assets->count().' assets must be checked in on or before '.$interval_date.' is deadline');
|
||||
$this->info($assets->count().' assets must be checked on or before '.Helper::getFormattedDateObject($interval_date, 'date', false));
|
||||
|
||||
|
||||
foreach ($assets as $asset) {
|
||||
if ($asset->assignedTo && (isset($asset->assignedTo->email)) && ($asset->assignedTo->email!='') && $asset->checkedOutToUser()) {
|
||||
$this->info('Sending User ExpectedCheckinNotification to: '.$asset->assignedTo->email);
|
||||
$asset->assignedTo->notify((new ExpectedCheckinNotification($asset)));
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->option('with-output')) {
|
||||
if (($assets) && ($assets->count() > 0) && ($settings->alert_email != '')) {
|
||||
$this->table(
|
||||
[
|
||||
trans('general.id'),
|
||||
trans('admin/hardware/form.tag'),
|
||||
trans('admin/hardware/form.model'),
|
||||
trans('general.model_no'),
|
||||
trans('general.purchase_date'),
|
||||
trans('admin/hardware/form.expected_checkin'),
|
||||
],
|
||||
$assets->map(fn($assets) => [
|
||||
trans('general.id') => $assets->id,
|
||||
trans('admin/hardware/form.tag') => $assets->asset_tag,
|
||||
trans('admin/hardware/form.model') => $assets->model->name,
|
||||
trans('general.model_no') => $assets->model->model_number,
|
||||
trans('general.purchase_date') => $assets->purchase_date_formatted,
|
||||
trans('admin/hardware/form.eol_date') => $assets->expected_checkin_formattedDate ? $assets->expected_checkin_formattedDate . ' (' . $assets->expected_checkin_diff_for_humans . ')' : '',
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +93,11 @@ class SendExpectedCheckinAlerts extends Command
|
||||
$recipients = collect(explode(',', $settings->alert_email))->map(function ($item) {
|
||||
return new AlertRecipient($item);
|
||||
});
|
||||
|
||||
$this->info('Sending Admin ExpectedCheckinNotification to: '.$settings->alert_email);
|
||||
\Notification::send($recipients, new ExpectedCheckinAdminNotification($assets));
|
||||
Notification::send($recipients, new ExpectedCheckinAdminNotification($assets));
|
||||
|
||||
}
|
||||
|
||||
$this->info('Sent checkin reminders to to '.$count.' users.');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ use App\Models\Company;
|
||||
use App\Models\Contracts\Acceptable;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Notifications\AcceptanceAssetAcceptedNotification;
|
||||
use App\Notifications\AcceptanceAssetAcceptedToUserNotification;
|
||||
use App\Notifications\AcceptanceAssetDeclinedNotification;
|
||||
use App\Notifications\AcceptanceItemAcceptedNotification;
|
||||
use App\Notifications\AcceptanceItemAcceptedToUserNotification;
|
||||
use App\Notifications\AcceptanceItemDeclinedNotification;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
@@ -138,14 +138,14 @@ class AcceptanceController extends Controller
|
||||
// Convert PDF logo to base64 for TCPDF
|
||||
// This is needed for TCPDF to properly embed the image if it's a png and the cache isn't writable
|
||||
$encoded_logo = null;
|
||||
if ($settings->acceptance_pdf_logo) {
|
||||
if (($settings->acceptance_pdf_logo) && (Storage::disk('public')->exists($settings->acceptance_pdf_logo))) {
|
||||
$encoded_logo = base64_encode(file_get_contents(public_path() . '/uploads/' . $settings->acceptance_pdf_logo));
|
||||
}
|
||||
|
||||
// Get the data array ready for the notifications and PDF generation
|
||||
$data = [
|
||||
'item_tag' => $item->asset_tag,
|
||||
'item_name' => $item->name, // this handles licenses seats, which don't have a 'name' field
|
||||
'item_name' => $item->display_name, // this handles licenses seats, which don't have a 'name' field
|
||||
'item_model' => $item->model?->name,
|
||||
'item_serial' => $item->serial,
|
||||
'item_status' => $item->assetstatus?->name,
|
||||
@@ -183,13 +183,13 @@ class AcceptanceController extends Controller
|
||||
// Add the attachment for the signing user into the $data array
|
||||
$data['file'] = $pdf_filename;
|
||||
try {
|
||||
$assigned_user->notify((new AcceptanceAssetAcceptedToUserNotification($data))->locale($assigned_user->locale));
|
||||
$assigned_user->notify((new AcceptanceItemAcceptedToUserNotification($data))->locale($assigned_user->locale));
|
||||
} catch (\Exception $e) {
|
||||
Log::warning($e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$acceptance->notify((new AcceptanceAssetAcceptedNotification($data))->locale(Setting::getSettings()->locale));
|
||||
$acceptance->notify((new AcceptanceItemAcceptedNotification($data))->locale(Setting::getSettings()->locale));
|
||||
} catch (\Exception $e) {
|
||||
Log::warning($e);
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class AcceptanceController extends Controller
|
||||
$acceptance->decline($sig_filename, $request->input('note'));
|
||||
}
|
||||
|
||||
$acceptance->notify(new AcceptanceAssetDeclinedNotification($data));
|
||||
$acceptance->notify(new AcceptanceItemDeclinedNotification($data));
|
||||
Log::debug('New event acceptance.');
|
||||
event(new CheckoutDeclined($acceptance));
|
||||
$return_msg = trans('admin/users/message.declined');
|
||||
|
||||
@@ -3,37 +3,38 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Events\CheckoutableCheckedIn;
|
||||
use App\Http\Requests\StoreAssetRequest;
|
||||
use App\Http\Requests\UpdateAssetRequest;
|
||||
use App\Http\Traits\MigratesLegacyAssetLocations;
|
||||
use App\Http\Transformers\ComponentsTransformer;
|
||||
use App\Models\AccessoryCheckout;
|
||||
use App\Models\CheckoutAcceptance;
|
||||
use App\Models\LicenseSeat;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\AssetCheckoutRequest;
|
||||
use App\Http\Requests\FilterRequest;
|
||||
use App\Http\Requests\StoreAssetRequest;
|
||||
use App\Http\Requests\UpdateAssetRequest;
|
||||
use App\Http\Traits\MigratesLegacyAssetLocations;
|
||||
use App\Http\Transformers\AssetsTransformer;
|
||||
use App\Http\Transformers\ComponentsTransformer;
|
||||
use App\Http\Transformers\LicensesTransformer;
|
||||
use App\Http\Transformers\SelectlistTransformer;
|
||||
use App\Models\AccessoryCheckout;
|
||||
use App\Models\Asset;
|
||||
use App\Models\AssetModel;
|
||||
use App\Models\CheckoutAcceptance;
|
||||
use App\Models\Company;
|
||||
use App\Models\CustomField;
|
||||
use App\Models\License;
|
||||
use App\Models\LicenseSeat;
|
||||
use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\View\Label;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\View\Label;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
@@ -56,7 +57,7 @@ class AssetsController extends Controller
|
||||
* @param int $assetId
|
||||
* @since [v4.0]
|
||||
*/
|
||||
public function index(Request $request, $action = null, $upcoming_status = null) : JsonResponse | array
|
||||
public function index(FilterRequest $request, $action = null, $upcoming_status = null) : JsonResponse | array
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class CategoriesController extends Controller
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'image',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
@@ -57,6 +58,7 @@ class CategoriesController extends Controller
|
||||
'require_acceptance',
|
||||
'checkin_email',
|
||||
'image',
|
||||
'tag_color',
|
||||
'notes',
|
||||
])
|
||||
->with('adminuser')
|
||||
|
||||
@@ -38,6 +38,7 @@ class CompaniesController extends Controller
|
||||
'accessories_count',
|
||||
'consumables_count',
|
||||
'components_count',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
@@ -64,6 +65,11 @@ class CompaniesController extends Controller
|
||||
$companies->where('created_by', '=', $request->input('created_by'));
|
||||
}
|
||||
|
||||
if ($request->filled('tag_color')) {
|
||||
$companies->where('tag_color', '=', $request->input('tag_color'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $companies->count()) ? $companies->count() : app('api_offset_value');
|
||||
@@ -191,6 +197,7 @@ class CompaniesController extends Controller
|
||||
'companies.name',
|
||||
'companies.email',
|
||||
'companies.image',
|
||||
'companies.tag_color',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class DepartmentsController extends Controller
|
||||
public function index(Request $request) : JsonResponse | array
|
||||
{
|
||||
$this->authorize('view', Department::class);
|
||||
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes'];
|
||||
$allowed_columns = ['id', 'name', 'image', 'users_count', 'notes', 'tag_color'];
|
||||
|
||||
$departments = Department::select(
|
||||
[
|
||||
@@ -38,8 +38,9 @@ class DepartmentsController extends Controller
|
||||
'departments.created_at',
|
||||
'departments.updated_at',
|
||||
'departments.image',
|
||||
'departments.tag_color',
|
||||
'departments.notes'
|
||||
])->with('users')->with('location')->with('manager')->with('company')->withCount('users as users_count');
|
||||
])->with('location')->with('manager')->with('company')->withCount('users as users_count');
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$departments = $departments->TextSearch($request->input('search'));
|
||||
@@ -61,6 +62,10 @@ class DepartmentsController extends Controller
|
||||
$departments->where('location_id', '=', $request->input('location_id'));
|
||||
}
|
||||
|
||||
if ($request->filled('tag_color')) {
|
||||
$departments->where('tag_color', '=', $request->input('departments.tag_color'));
|
||||
}
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $departments->count()) ? $departments->count() : app('api_offset_value');
|
||||
$limit = app('api_limit_value');
|
||||
@@ -186,6 +191,7 @@ class DepartmentsController extends Controller
|
||||
'id',
|
||||
'name',
|
||||
'image',
|
||||
'tag_color',
|
||||
]);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
|
||||
@@ -79,17 +79,14 @@ class LicenseSeatsController extends Controller
|
||||
{
|
||||
|
||||
$this->authorize('view', License::class);
|
||||
// sanity checks:
|
||||
// 1. does the license seat exist?
|
||||
if (! $licenseSeat = LicenseSeat::find($seatId)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat not found'));
|
||||
}
|
||||
// 2. does the seat belong to the specified license?
|
||||
if (! $licenseSeat = $licenseSeat->license()->first() || $licenseSeat->id != intval($licenseId)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat does not belong to the specified license'));
|
||||
|
||||
if ($licenseSeat = LicenseSeat::where('license_id', $licenseId)->find($seatId)) {
|
||||
return (new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat);
|
||||
}
|
||||
|
||||
return (new LicenseSeatsTransformer)->transformLicenseSeat($licenseSeat);
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Seat ID or license not found or the seat does not belong to this license'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,17 +119,22 @@ class LicenseSeatsController extends Controller
|
||||
|
||||
// check if this update is a checkin operation
|
||||
// 1. are relevant fields touched at all?
|
||||
$touched = $licenseSeat->isDirty('assigned_to') || $licenseSeat->isDirty('asset_id');
|
||||
// 2. are they cleared? if yes then this is a checkin operation
|
||||
$is_checkin = ($touched && $licenseSeat->assigned_to === null && $licenseSeat->asset_id === null);
|
||||
$assignmentTouched = $licenseSeat->isDirty('assigned_to') || $licenseSeat->isDirty('asset_id');
|
||||
$anythingTouched = $licenseSeat->isDirty();
|
||||
|
||||
if (! $touched) {
|
||||
// nothing to update
|
||||
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
|
||||
if (! $anythingTouched) {
|
||||
return response()->json(
|
||||
Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success'))
|
||||
);
|
||||
}
|
||||
if( $touched && $licenseSeat->unreassignable_seat) {
|
||||
if( $assignmentTouched && $licenseSeat->unreassignable_seat) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/licenses/message.checkout.unavailable')));
|
||||
}
|
||||
|
||||
// 2. are they cleared? if yes then this is a checkin operation
|
||||
$is_checkin = ($assignmentTouched && $licenseSeat->assigned_to === null && $licenseSeat->asset_id === null);
|
||||
$target = null;
|
||||
|
||||
// the logging functions expect only one "target". if both asset and user are present in the request,
|
||||
// we simply let assets take precedence over users...
|
||||
if ($licenseSeat->isDirty('assigned_to')) {
|
||||
@@ -142,25 +144,23 @@ class LicenseSeatsController extends Controller
|
||||
$target = $is_checkin ? $oldAsset : Asset::find($licenseSeat->asset_id);
|
||||
}
|
||||
|
||||
if (is_null($target)){
|
||||
if ($assignmentTouched && is_null($target)){
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Target not found'));
|
||||
}
|
||||
|
||||
if ($licenseSeat->save()) {
|
||||
|
||||
if ($is_checkin) {
|
||||
if(!$licenseSeat->license->reassignable){
|
||||
$licenseSeat->unreassignable_seat = true;
|
||||
$licenseSeat->save();
|
||||
if($assignmentTouched) {
|
||||
if ($is_checkin) {
|
||||
if (!$licenseSeat->license->reassignable) {
|
||||
$licenseSeat->unreassignable_seat = true;
|
||||
$licenseSeat->save();
|
||||
}
|
||||
$licenseSeat->logCheckin($target, $licenseSeat->notes);
|
||||
} else {
|
||||
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
|
||||
$licenseSeat->logCheckout($request->input('notes'), $target);
|
||||
}
|
||||
$licenseSeat->logCheckin($target, $licenseSeat->notes);
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
|
||||
}
|
||||
|
||||
// in this case, relevant fields are touched but it's not a checkin operation. so it must be a checkout operation.
|
||||
$licenseSeat->logCheckout($request->input('notes'), $target);
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ class LocationsController extends Controller
|
||||
'state',
|
||||
'updated_at',
|
||||
'zip',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
@@ -81,6 +82,8 @@ class LocationsController extends Controller
|
||||
'locations.ldap_ou',
|
||||
'locations.currency',
|
||||
'locations.company_id',
|
||||
'locations.tag_color',
|
||||
'locations.tag_color',
|
||||
'locations.notes',
|
||||
'locations.created_by',
|
||||
'locations.deleted_at',
|
||||
@@ -145,6 +148,10 @@ class LocationsController extends Controller
|
||||
$locations->onlyTrashed();
|
||||
}
|
||||
|
||||
if ($request->filled('tag_color')) {
|
||||
$locations->where('tag_color', '=', $request->input('locations.tag_color'));
|
||||
}
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $locations->count()) ? $locations->count() : app('api_offset_value');
|
||||
$limit = app('api_limit_value');
|
||||
@@ -402,6 +409,7 @@ class LocationsController extends Controller
|
||||
'locations.name',
|
||||
'locations.parent_id',
|
||||
'locations.image',
|
||||
'locations.tag_color',
|
||||
]);
|
||||
|
||||
// Only scope locations if the setting is enabled
|
||||
|
||||
@@ -47,6 +47,7 @@ class ManufacturersController extends Controller
|
||||
'consumables_count',
|
||||
'components_count',
|
||||
'licenses_count',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
@@ -63,6 +64,7 @@ class ManufacturersController extends Controller
|
||||
'updated_at',
|
||||
'image',
|
||||
'deleted_at',
|
||||
'tag_color',
|
||||
'notes',
|
||||
])
|
||||
->with('adminuser')
|
||||
@@ -104,6 +106,10 @@ class ManufacturersController extends Controller
|
||||
$manufacturers->where('support_email', '=', $request->input('support_email'));
|
||||
}
|
||||
|
||||
if ($request->filled('tag_color')) {
|
||||
$manufacturers->where('tag_color', '=', $request->input('manufacturers.tag_color'));
|
||||
}
|
||||
|
||||
// Make sure the offset and limit are actually integers and do not exceed system limits
|
||||
$offset = ($request->input('offset') > $manufacturers->count()) ? $manufacturers->count() : app('api_offset_value');
|
||||
$limit = app('api_limit_value');
|
||||
@@ -258,6 +264,7 @@ class ManufacturersController extends Controller
|
||||
'id',
|
||||
'name',
|
||||
'image',
|
||||
'tag_color',
|
||||
]);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
|
||||
@@ -50,12 +50,13 @@ class SuppliersController extends Controller
|
||||
'accessories_count',
|
||||
'components_count',
|
||||
'consumables_count',
|
||||
'tag_color',
|
||||
'url',
|
||||
'notes',
|
||||
];
|
||||
|
||||
$suppliers = Supplier::select(
|
||||
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip'])
|
||||
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip', 'tag_color'])
|
||||
->withCount('assets as assets_count')
|
||||
->withCount('licenses as licenses_count')
|
||||
->withCount('accessories as accessories_count')
|
||||
@@ -251,6 +252,7 @@ class SuppliersController extends Controller
|
||||
'id',
|
||||
'name',
|
||||
'image',
|
||||
'tag_color',
|
||||
]);
|
||||
|
||||
if ($request->filled('search')) {
|
||||
|
||||
@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Requests\DeleteUserRequest;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Requests\FilterRequest;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
@@ -42,7 +43,7 @@ class UsersController extends Controller
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function index(Request $request) : array
|
||||
public function index(FilterRequest $request) : array
|
||||
{
|
||||
$this->authorize('view', User::class);
|
||||
|
||||
@@ -162,6 +163,11 @@ class UsersController extends Controller
|
||||
|
||||
if ($request->filled('filter')) {
|
||||
$filter = json_decode($request->input('filter'), true);
|
||||
|
||||
if (is_null($filter)) {
|
||||
$filter = [];
|
||||
}
|
||||
|
||||
$filter = array_filter($filter, function ($key) use ($allowed_columns) {
|
||||
return in_array($key, $allowed_columns);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
@@ -78,6 +78,7 @@ class CategoriesController extends Controller
|
||||
$category->require_acceptance = $request->input('require_acceptance', '0');
|
||||
$category->alert_on_response = $request->input('alert_on_response', '0');
|
||||
$category->checkin_email = $request->input('checkin_email', '0');
|
||||
$category->tag_color = $request->input('tag_color');
|
||||
$category->notes = $request->input('notes');
|
||||
$category->created_by = auth()->id();
|
||||
|
||||
@@ -132,6 +133,7 @@ class CategoriesController extends Controller
|
||||
$category->require_acceptance = $request->input('require_acceptance', '0');
|
||||
$category->alert_on_response = $request->input('alert_on_response', '0');
|
||||
$category->checkin_email = $request->input('checkin_email', '0');
|
||||
$category->tag_color = $request->input('tag_color');
|
||||
$category->notes = $request->input('notes');
|
||||
|
||||
$category = $request->handleImages($category);
|
||||
|
||||
@@ -60,6 +60,7 @@ final class CompaniesController extends Controller
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
$company->email = $request->input('email');
|
||||
$company->tag_color = $request->input('tag_color');
|
||||
$company->notes = $request->input('notes');
|
||||
$company->created_by = auth()->id();
|
||||
|
||||
@@ -102,6 +103,7 @@ final class CompaniesController extends Controller
|
||||
$company->phone = $request->input('phone');
|
||||
$company->fax = $request->input('fax');
|
||||
$company->email = $request->input('email');
|
||||
$company->tag_color = $request->input('tag_color');
|
||||
$company->notes = $request->input('notes');
|
||||
|
||||
$company = $request->handleImages($company);
|
||||
|
||||
@@ -55,6 +55,7 @@ class DepartmentsController extends Controller
|
||||
$department->manager_id = ($request->filled('manager_id') ? $request->input('manager_id') : null);
|
||||
$department->location_id = ($request->filled('location_id') ? $request->input('location_id') : null);
|
||||
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
|
||||
$department->tag_color = $request->input('tag_color');
|
||||
$department->notes = $request->input('notes');
|
||||
$department = $request->handleImages($department);
|
||||
|
||||
@@ -157,6 +158,7 @@ class DepartmentsController extends Controller
|
||||
$department->company_id = ($request->filled('company_id') ? $request->input('company_id') : null);
|
||||
$department->phone = $request->input('phone');
|
||||
$department->fax = $request->input('fax');
|
||||
$department->tag_color = $request->input('tag_color');
|
||||
$department->notes = $request->input('notes');
|
||||
$department = $request->handleImages($department);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Models\Group;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use \Illuminate\Contracts\View\View;
|
||||
use \App\Models\User;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to User Groups for
|
||||
@@ -43,12 +44,20 @@ class GroupsController extends Controller
|
||||
$permissions = config('permissions');
|
||||
$groupPermissions = Helper::selectedPermissionsArray($permissions, $permissions);
|
||||
$selectedPermissions = $request->old('permissions', $groupPermissions);
|
||||
$users = \App\Models\User::orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
$users_query = User::where('show_in_list', 1)->whereNull('deleted_at');
|
||||
$users_count = $users_query->count();
|
||||
|
||||
$users = collect();
|
||||
if ($users_count <= config('app.max_unpaginated_records')) {
|
||||
$users = $users_query->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
}
|
||||
|
||||
// Show the page
|
||||
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
|
||||
->with('group', $group)
|
||||
->with('associated_users', [])
|
||||
->with('unselected_users', $users);
|
||||
->with('unselected_users', $users)
|
||||
->with('all_users_count', $users_count);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,13 +111,26 @@ class GroupsController extends Controller
|
||||
if ((!is_array($groupPermissions)) || (!$groupPermissions)) {
|
||||
$groupPermissions = [];
|
||||
}
|
||||
|
||||
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
|
||||
$associated_users = $group->users()->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
|
||||
// Get the unselected users
|
||||
$unselected_users = \App\Models\User::whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
|
||||
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))->with('associated_users', $associated_users)->with('unselected_users', $unselected_users);
|
||||
$users_query = User::where('show_in_list', 1)->whereNull('deleted_at');
|
||||
$users_count = $users_query->count();
|
||||
|
||||
$associated_users = collect();
|
||||
$unselected_users = collect();
|
||||
|
||||
if ($users_count <= config('app.max_unpaginated_records')) {
|
||||
$associated_users = $group->users()->where('show_in_list', 1)->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
// Get the unselected users
|
||||
$unselected_users = User::where('show_in_list', 1)->whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||
}
|
||||
|
||||
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))
|
||||
->with('associated_users', $associated_users)
|
||||
->with('unselected_users', $unselected_users)
|
||||
->with('all_users_count', $users_count);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +157,7 @@ class GroupsController extends Controller
|
||||
if (! config('app.lock_passwords')) {
|
||||
if ($group->save()) {
|
||||
|
||||
if ($request->filled('users_to_sync')) {
|
||||
if ($request->has('users_to_sync')) {
|
||||
$associated_users = explode(',',$request->input('users_to_sync'));
|
||||
$group->users()->sync($associated_users);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ class LocationsController extends Controller
|
||||
$location->created_by = auth()->id();
|
||||
$location->phone = request('phone');
|
||||
$location->fax = request('fax');
|
||||
$location->tag_color = $request->input('tag_color');
|
||||
$location->notes = $request->input('notes');
|
||||
$location->company_id = Company::getIdForCurrentUser($request->input('company_id'));
|
||||
|
||||
@@ -156,6 +157,7 @@ class LocationsController extends Controller
|
||||
$location->fax = request('fax');
|
||||
$location->ldap_ou = $request->input('ldap_ou');
|
||||
$location->manager_id = $request->input('manager_id');
|
||||
$location->tag_color = $request->input('tag_color');
|
||||
$location->notes = $request->input('notes');
|
||||
|
||||
// Only scope the location if the setting is enabled
|
||||
|
||||
@@ -101,6 +101,7 @@ class ManufacturersController extends Controller
|
||||
$manufacturer->support_email = $request->input('support_email');
|
||||
$manufacturer->notes = $request->input('notes');
|
||||
$manufacturer = $request->handleImages($manufacturer);
|
||||
$manufacturer->tag_color = $request->input('tag_color');
|
||||
|
||||
if ($manufacturer->save()) {
|
||||
return redirect()->route('manufacturers.index')->with('success', trans('admin/manufacturers/message.create.success'));
|
||||
@@ -142,6 +143,7 @@ class ManufacturersController extends Controller
|
||||
$manufacturer->warranty_lookup_url = $request->input('warranty_lookup_url');
|
||||
$manufacturer->support_phone = $request->input('support_phone');
|
||||
$manufacturer->support_email = $request->input('support_email');
|
||||
$manufacturer->tag_color = $request->input('tag_color');
|
||||
$manufacturer->notes = $request->input('notes');
|
||||
|
||||
// Set the model's image property to null if the image is being deleted
|
||||
|
||||
@@ -1148,7 +1148,9 @@ class ReportsController extends Controller
|
||||
$query->withTrashed();
|
||||
}
|
||||
|
||||
$itemsForReport = $query->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
|
||||
$itemsForReport = $query->get()
|
||||
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
|
||||
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
|
||||
|
||||
return view('reports/unaccepted_assets', compact('itemsForReport','showDeleted' ));
|
||||
}
|
||||
@@ -1288,7 +1290,9 @@ class ReportsController extends Controller
|
||||
$acceptances->withTrashed();
|
||||
}
|
||||
|
||||
$itemsForReport = $acceptances->get()->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
|
||||
$itemsForReport = $acceptances->get()
|
||||
->filter(fn ($unaccepted) => $unaccepted->checkoutable)
|
||||
->map(fn ($unaccepted) => Checkoutable::fromAcceptance($unaccepted));
|
||||
|
||||
$rows = [];
|
||||
|
||||
|
||||
@@ -589,6 +589,7 @@ class SettingsController extends Controller
|
||||
$setting->time_display_format = $request->input('time_display_format');
|
||||
$setting->digit_separator = $request->input('digit_separator');
|
||||
$setting->name_display_format = $request->input('name_display_format');
|
||||
$setting->week_start = $request->input('week_start', 0);
|
||||
|
||||
if ($setting->save()) {
|
||||
return redirect()->route('settings.index')
|
||||
|
||||
@@ -67,6 +67,7 @@ class SuppliersController extends Controller
|
||||
$supplier->phone = request('phone');
|
||||
$supplier->fax = request('fax');
|
||||
$supplier->email = request('email');
|
||||
$supplier->tag_color = $request->input('tag_color');
|
||||
$supplier->notes = request('notes');
|
||||
$supplier->url = $supplier->addhttp(request('url'));
|
||||
$supplier->created_by = auth()->id();
|
||||
@@ -111,6 +112,7 @@ class SuppliersController extends Controller
|
||||
$supplier->fax = request('fax');
|
||||
$supplier->email = request('email');
|
||||
$supplier->url = $supplier->addhttp(request('url'));
|
||||
$supplier->tag_color = $request->input('tag_color');
|
||||
$supplier->notes = request('notes');
|
||||
$supplier = $request->handleImages($supplier);
|
||||
|
||||
|
||||
@@ -156,7 +156,19 @@ class ViewAssetsController extends Controller
|
||||
public function getRequestableIndex() : View
|
||||
{
|
||||
$assets = Asset::with('model', 'defaultLoc', 'location', 'assignedTo', 'requests')->Hardware()->RequestableAssets();
|
||||
$models = AssetModel::with('category', 'requests', 'assets')->RequestableModels()->get();
|
||||
$models = AssetModel::with([
|
||||
'category',
|
||||
'requests',
|
||||
'assets' => function ($q) {
|
||||
$q->where('requestable', 1)
|
||||
->whereHas('assetstatus', fn ($s) =>
|
||||
$s->where('archived', 0)
|
||||
->where(fn ($s) =>
|
||||
$s->where('deployable', 1)->orWhere('pending', 1)
|
||||
)
|
||||
);
|
||||
},
|
||||
])->RequestableModels()->get();
|
||||
|
||||
return view('account/requestable-assets', compact('assets', 'models'));
|
||||
}
|
||||
|
||||
29
app/Http/Requests/FilterRequest.php
Normal file
29
app/Http/Requests/FilterRequest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Rules\ValidJson;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class FilterRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'filter' => ['nullable', new ValidJson()],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,32 @@ class AccessoriesTransformer
|
||||
'id' => $accessory->id,
|
||||
'name' => e($accessory->name),
|
||||
'image' => ($accessory->image) ? Storage::disk('public')->url('accessories/'.e($accessory->image)) : null,
|
||||
'company' => ($accessory->company) ? ['id' => $accessory->company->id, 'name'=> e($accessory->company->name)] : null,
|
||||
'manufacturer' => ($accessory->manufacturer) ? ['id' => $accessory->manufacturer->id, 'name'=> e($accessory->manufacturer->name)] : null,
|
||||
'supplier' => ($accessory->supplier) ? ['id' => $accessory->supplier->id, 'name'=> e($accessory->supplier->name)] : null,
|
||||
'company' => ($accessory->company) ? [
|
||||
'id' => $accessory->company->id,
|
||||
'name'=> e($accessory->company->name),
|
||||
'tag_color'=> ($accessory->company->tag_color) ? e($accessory->company->tag_color) : null,
|
||||
] : null,
|
||||
'manufacturer' => ($accessory->manufacturer) ? [
|
||||
'id' => $accessory->manufacturer->id,
|
||||
'name'=> e($accessory->manufacturer->name),
|
||||
'tag_color'=> ($accessory->manufacturer->tag_color) ? e($accessory->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'supplier' => ($accessory->supplier) ? [
|
||||
'id' => $accessory->supplier->id,
|
||||
'name'=> e($accessory->supplier->name),
|
||||
'tag_color'=> ($accessory->supplier->tag_color) ? e($accessory->supplier->tag_color) : null,
|
||||
] : null,
|
||||
'model_number' => ($accessory->model_number) ? e($accessory->model_number) : null,
|
||||
'category' => ($accessory->category) ? ['id' => $accessory->category->id, 'name'=> e($accessory->category->name)] : null,
|
||||
'location' => ($accessory->location) ? ['id' => $accessory->location->id, 'name'=> e($accessory->location->name)] : null,
|
||||
'category' => ($accessory->category) ? [
|
||||
'id' => $accessory->category->id,
|
||||
'name'=> e($accessory->category->name),
|
||||
'tag_color'=> ($accessory->category->tag_color) ? e($accessory->category->tag_color) : null,
|
||||
] : null,
|
||||
'location' => ($accessory->location) ? [
|
||||
'id' => $accessory->location->id,
|
||||
'name'=> e($accessory->location->name),
|
||||
'tag_color'=> ($accessory->location->tag_color) ? e($accessory->location->tag_color) : null,
|
||||
] : null,
|
||||
'notes' => ($accessory->notes) ? Helper::parseEscapedMarkedownInline($accessory->notes) : null,
|
||||
'qty' => ($accessory->qty) ? (int) $accessory->qty : null,
|
||||
'purchase_date' => ($accessory->purchase_date) ? Helper::getFormattedDateObject($accessory->purchase_date, 'date') : null,
|
||||
|
||||
@@ -161,6 +161,7 @@ class ActionlogsTransformer
|
||||
'location' => ($actionlog->location) ? [
|
||||
'id' => (int) $actionlog->location->id,
|
||||
'name' => e($actionlog->location->name),
|
||||
'tag_color'=> ($actionlog->location->tag_color) ? e($actionlog->location->tag_color) : null,
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($actionlog->updated_at, 'datetime'),
|
||||
|
||||
@@ -44,6 +44,7 @@ class AssetModelsTransformer
|
||||
'manufacturer' => ($assetmodel->manufacturer) ? [
|
||||
'id' => (int) $assetmodel->manufacturer->id,
|
||||
'name'=> e($assetmodel->manufacturer->name),
|
||||
'tag_color'=> ($assetmodel->manufacturer->tag_color) ? e($assetmodel->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'image' => ($assetmodel->image != '') ? Storage::disk('public')->url('models/'.e($assetmodel->image)) : null,
|
||||
'model_number' => ($assetmodel->model_number ? e($assetmodel->model_number): null),
|
||||
@@ -60,6 +61,7 @@ class AssetModelsTransformer
|
||||
'category' => ($assetmodel->category) ? [
|
||||
'id' => (int) $assetmodel->category->id,
|
||||
'name'=> e($assetmodel->category->name),
|
||||
'tag_color'=> ($assetmodel->category->tag_color) ? e($assetmodel->category->tag_color) : null,
|
||||
] : null,
|
||||
'fieldset' => ($assetmodel->fieldset) ? [
|
||||
'id' => (int) $assetmodel->fieldset->id,
|
||||
|
||||
@@ -40,7 +40,6 @@ class AssetsTransformer
|
||||
] : null,
|
||||
'byod' => ($asset->byod ? true : false),
|
||||
'requestable' => ($asset->requestable ? true : false),
|
||||
|
||||
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
||||
'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? (int) Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date, true) . ' months' : null,
|
||||
'asset_eol_date' => ($asset->asset_eol_date != '') ? Helper::getFormattedDateObject($asset->asset_eol_date, 'date') : null,
|
||||
@@ -53,10 +52,12 @@ class AssetsTransformer
|
||||
'category' => (($asset->model) && ($asset->model->category)) ? [
|
||||
'id' => (int) $asset->model->category->id,
|
||||
'name'=> e($asset->model->category->name),
|
||||
'tag_color'=> ($asset->model->category->tag_color) ? e($asset->model->category->tag_color) : null,
|
||||
] : null,
|
||||
'manufacturer' => (($asset->model) && ($asset->model->manufacturer)) ? [
|
||||
'id' => (int) $asset->model->manufacturer->id,
|
||||
'name'=> e($asset->model->manufacturer->name),
|
||||
'tag_color'=> ($asset->model->manufacturer->tag_color) ? e($asset->model->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'depreciation' => (($asset->model) && ($asset->model->depreciation)) ? [
|
||||
'id' => (int) $asset->model->depreciation->id,
|
||||
@@ -68,20 +69,24 @@ class AssetsTransformer
|
||||
'supplier' => ($asset->supplier) ? [
|
||||
'id' => (int) $asset->supplier->id,
|
||||
'name'=> e($asset->supplier->name),
|
||||
'tag_color'=> ($asset->supplier->tag_color) ? e($asset->supplier->tag_color) : null,
|
||||
] : null,
|
||||
'notes' => ($asset->notes) ? Helper::parseEscapedMarkedownInline($asset->notes) : null,
|
||||
'order_number' => ($asset->order_number) ? e($asset->order_number) : null,
|
||||
'company' => ($asset->company) ? [
|
||||
'id' => (int) $asset->company->id,
|
||||
'name'=> e($asset->company->name),
|
||||
'tag_color'=> ($asset->company->tag_color) ? e($asset->company->tag_color) : null,
|
||||
] : null,
|
||||
'location' => ($asset->location) ? [
|
||||
'id' => (int) $asset->location->id,
|
||||
'name'=> e($asset->location->name),
|
||||
'tag_color'=> ($asset->location->tag_color) ? e($asset->location->tag_color) : null,
|
||||
] : null,
|
||||
'rtd_location' => ($asset->defaultLoc) ? [
|
||||
'id' => (int) $asset->defaultLoc->id,
|
||||
'name'=> e($asset->defaultLoc->name),
|
||||
'tag_color'=> ($asset->defaultLoc->tag_color) ? e($asset->defaultLoc->tag_color) : null,
|
||||
] : null,
|
||||
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
|
||||
'qr' => ($setting->qr_code=='1') ? config('app.url').'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png' : null,
|
||||
|
||||
@@ -66,6 +66,7 @@ class CategoriesTransformer
|
||||
'id' => (int) $category->adminuser->id,
|
||||
'name'=> e($category->adminuser->display_name),
|
||||
] : null,
|
||||
'tag_color' => $category->tag_color ? e($category->tag_color) : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($category->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($category->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($category->updated_at, 'datetime'),
|
||||
|
||||
@@ -40,6 +40,7 @@ class CompaniesTransformer
|
||||
'id' => (int) $company->adminuser->id,
|
||||
'name'=> e($company->adminuser->display_name),
|
||||
] : null,
|
||||
'tag_color' => ($company->tag_color!='') ? e($company->tag_color): null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($company->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($company->updated_at, 'datetime'),
|
||||
|
||||
@@ -30,15 +30,25 @@ class ComponentsTransformer
|
||||
'location' => ($component->location) ? [
|
||||
'id' => (int) $component->location->id,
|
||||
'name' => e($component->location->name),
|
||||
'tag_color' => $component->location->tag_color ? e($component->location->tag_color) : null,
|
||||
] : null,
|
||||
'qty' => ($component->qty != '') ? (int) $component->qty : null,
|
||||
'min_amt' => ($component->min_amt != '') ? (int) $component->min_amt : null,
|
||||
'category' => ($component->category) ? [
|
||||
'id' => (int) $component->category->id,
|
||||
'name' => e($component->category->name),
|
||||
'tag_color' => $component->category->tag_color ? e($component->category->tag_color) : null,
|
||||
] : null,
|
||||
'supplier' => ($component->supplier) ? [
|
||||
'id' => $component->supplier->id,
|
||||
'name'=> e($component->supplier->name),
|
||||
'tag_color' => $component->supplier->tag_color ? e($component->supplier->tag_color) : null,
|
||||
] : null,
|
||||
'manufacturer' => ($component->manufacturer) ? [
|
||||
'id' => $component->manufacturer->id,
|
||||
'name'=> e($component->manufacturer->name),
|
||||
'tag_color' => $component->manufacturer->tag_color ? e($component->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'supplier' => ($component->supplier) ? ['id' => $component->supplier->id, 'name'=> e($component->supplier->name)] : null,
|
||||
'manufacturer' => ($component->manufacturer) ? ['id' => $component->manufacturer->id, 'name'=> e($component->manufacturer->name)] : null,
|
||||
'model_number' => ($component->model_number) ? e($component->model_number) : null,
|
||||
'order_number' => e($component->order_number),
|
||||
'purchase_date' => Helper::getFormattedDateObject($component->purchase_date, 'date'),
|
||||
@@ -48,6 +58,7 @@ class ComponentsTransformer
|
||||
'company' => ($component->company) ? [
|
||||
'id' => (int) $component->company->id,
|
||||
'name' => e($component->company->name),
|
||||
'tag_color' => $component->company->tag_color ? e($component->company->tag_color) : null,
|
||||
] : null,
|
||||
'notes' => ($component->notes) ? Helper::parseEscapedMarkedownInline($component->notes) : null,
|
||||
'created_by' => ($component->adminuser) ? [
|
||||
|
||||
@@ -26,12 +26,32 @@ class ConsumablesTransformer
|
||||
'id' => (int) $consumable->id,
|
||||
'name' => e($consumable->name),
|
||||
'image' => ($consumable->getImageUrl()) ? ($consumable->getImageUrl()) : null,
|
||||
'category' => ($consumable->category) ? ['id' => $consumable->category->id, 'name' => e($consumable->category->name)] : null,
|
||||
'company' => ($consumable->company) ? ['id' => (int) $consumable->company->id, 'name' => e($consumable->company->name)] : null,
|
||||
'category' => ($consumable->category) ? [
|
||||
'id' => $consumable->category->id,
|
||||
'name' => e($consumable->category->name),
|
||||
'tag_color' => $consumable->category->tag_color ? e($consumable->category->tag_color) : null,
|
||||
] : null,
|
||||
'company' => ($consumable->company) ? [
|
||||
'id' => (int) $consumable->company->id,
|
||||
'name' => e($consumable->company->name),
|
||||
'tag_color' => $consumable->company->tag_color ? e($consumable->company->tag_color) : null,
|
||||
] : null,
|
||||
'item_no' => e($consumable->item_no),
|
||||
'location' => ($consumable->location) ? ['id' => (int) $consumable->location->id, 'name' => e($consumable->location->name)] : null,
|
||||
'manufacturer' => ($consumable->manufacturer) ? ['id' => (int) $consumable->manufacturer->id, 'name' => e($consumable->manufacturer->name)] : null,
|
||||
'supplier' => ($consumable->supplier) ? ['id' => $consumable->supplier->id, 'name'=> e($consumable->supplier->name)] : null,
|
||||
'location' => ($consumable->location) ? [
|
||||
'id' => (int) $consumable->location->id,
|
||||
'name' => e($consumable->location->name),
|
||||
'tag_color' => $consumable->location->tag_color ? e($consumable->location->tag_color) : null,
|
||||
] : null,
|
||||
'manufacturer' => ($consumable->manufacturer) ? [
|
||||
'id' => (int) $consumable->manufacturer->id,
|
||||
'name' => e($consumable->manufacturer->name),
|
||||
'tag_color' => $consumable->manufacturer->tag_color ? e($consumable->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'supplier' => ($consumable->supplier) ? [
|
||||
'id' => $consumable->supplier->id,
|
||||
'name'=> e($consumable->supplier->name),
|
||||
'tag_color' => $consumable->supplier->tag_color ? e($consumable->supplier->tag_color) : null,
|
||||
] : null,
|
||||
'min_amt' => (int) $consumable->min_amt,
|
||||
'model_number' => ($consumable->model_number != '') ? e($consumable->model_number) : null,
|
||||
'remaining' => $consumable->numRemaining(),
|
||||
|
||||
@@ -32,6 +32,7 @@ class DepartmentsTransformer
|
||||
'company' => ($department->company) ? [
|
||||
'id' => (int) $department->company->id,
|
||||
'name'=> e($department->company->name),
|
||||
'tag_color' => $department->company->tag_color ? e($department->company->tag_color) : null,
|
||||
] : null,
|
||||
'manager' => ($department->manager) ? [
|
||||
'id' => (int) $department->manager->id,
|
||||
@@ -42,8 +43,10 @@ class DepartmentsTransformer
|
||||
'location' => ($department->location) ? [
|
||||
'id' => (int) $department->location->id,
|
||||
'name' => e($department->location->name),
|
||||
'tag_color' => $department->location->tag_color ? e($department->location->tag_color) : null,
|
||||
] : null,
|
||||
'users_count' => (int) ($department->users_count),
|
||||
'tag_color' => $department->tag_color ? e($department->tag_color) : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($department->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($department->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($department->updated_at, 'datetime'),
|
||||
|
||||
@@ -34,12 +34,14 @@ class LicenseSeatsTransformer
|
||||
[
|
||||
'id' => (int) $seat->user->department->id,
|
||||
'name' => e($seat->user->department->name),
|
||||
'tag_color' => $seat->user->department->tag_color ? e($seat->user->department->tag_color) : null,
|
||||
|
||||
] : null,
|
||||
'company'=> ($seat->user->company) ?
|
||||
[
|
||||
'id' => (int) $seat->user->company->id,
|
||||
'name' => e($seat->user->company->name),
|
||||
'tag_color' => $seat->user->company->tag_color ? e($seat->user->company->tag_color) : null,
|
||||
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
|
||||
@@ -52,6 +54,7 @@ class LicenseSeatsTransformer
|
||||
'location' => ($seat->location()) ? [
|
||||
'id' => (int) $seat->location()->id,
|
||||
'name'=> e($seat->location()->name),
|
||||
'tag_color' => $seat->location()->tag_color ? e($seat->location()->tag_color) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($seat->created_at, 'datetime'),
|
||||
] : null,
|
||||
'reassignable' => (bool) $seat->license->reassignable,
|
||||
|
||||
@@ -25,7 +25,11 @@ class LicensesTransformer
|
||||
'id' => (int) $license->id,
|
||||
'name' => e($license->name),
|
||||
'company' => ($license->company) ? ['id' => (int) $license->company->id, 'name'=> e($license->company->name)] : null,
|
||||
'manufacturer' => ($license->manufacturer) ? ['id' => (int) $license->manufacturer->id, 'name'=> e($license->manufacturer->name)] : null,
|
||||
'manufacturer' => ($license->manufacturer) ? [
|
||||
'id' => (int) $license->manufacturer->id,
|
||||
'name'=> e($license->manufacturer->name),
|
||||
'tag_color'=> ($license->manufacturer->tag_color) ? e($license->manufacturer->tag_color) : null,
|
||||
] : null,
|
||||
'product_key' => (Gate::allows('viewKeys', License::class)) ? e($license->serial) : '------------',
|
||||
'order_number' => ($license->order_number) ? e($license->order_number) : null,
|
||||
'purchase_order' => ($license->purchase_order) ? e($license->purchase_order) : null,
|
||||
@@ -44,8 +48,16 @@ class LicensesTransformer
|
||||
'license_email' => ($license->license_email) ? e($license->license_email) : null,
|
||||
'reassignable' => ($license->reassignable == 1) ? true : false,
|
||||
'maintained' => ($license->maintained == 1) ? true : false,
|
||||
'supplier' => ($license->supplier) ? ['id' => (int) $license->supplier->id, 'name'=> e($license->supplier->name)] : null,
|
||||
'category' => ($license->category) ? ['id' => (int) $license->category->id, 'name'=> e($license->category->name)] : null,
|
||||
'supplier' => ($license->supplier) ? [
|
||||
'id' => (int) $license->supplier->id,
|
||||
'name'=> e($license->supplier->name),
|
||||
'tag_color'=> ($license->supplier->tag_color) ? e($license->supplier->tag_color) : null,
|
||||
] : null,
|
||||
'category' => ($license->category) ? [
|
||||
'id' => (int) $license->category->id,
|
||||
'name'=> e($license->category->name),
|
||||
'tag_color'=> ($license->category->tag_color) ? e($license->category->tag_color) : null,
|
||||
] : null,
|
||||
'created_by' => ($license->adminuser) ? [
|
||||
'id' => (int) $license->adminuser->id,
|
||||
'name'=> e($license->adminuser->display_name),
|
||||
|
||||
@@ -58,6 +58,7 @@ class LocationsTransformer
|
||||
'children_count' => (int) $location->children_count,
|
||||
'currency' => ($location->currency) ? e($location->currency) : null,
|
||||
'ldap_ou' => ($location->ldap_ou) ? e($location->ldap_ou) : null,
|
||||
'tag_color' => $location->tag_color ? e($location->tag_color) : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($location->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
|
||||
'created_by' => $location->adminuser ? [
|
||||
@@ -68,11 +69,13 @@ class LocationsTransformer
|
||||
'parent' => ($location->parent) ? [
|
||||
'id' => (int) $location->parent->id,
|
||||
'name'=> e($location->parent->name),
|
||||
'tag_color' => $location->parent->tag_color ? e($location->parent->tag_color) : null,
|
||||
] : null,
|
||||
'manager' => ($location->manager) ? (new UsersTransformer)->transformUser($location->manager) : null,
|
||||
'company' => ($location->company) ? [
|
||||
'id' => (int) $location->company->id,
|
||||
'name'=> e($location->company->name)
|
||||
'name'=> e($location->company->name),
|
||||
'tag_color' => $location->company->tag_color ? e($location->company->tag_color) : null,
|
||||
] : null,
|
||||
|
||||
'children' => $children_arr,
|
||||
|
||||
@@ -37,6 +37,7 @@ class ManufacturersTransformer
|
||||
'consumables_count' => (int) $manufacturer->consumables_count,
|
||||
'accessories_count' => (int) $manufacturer->accessories_count,
|
||||
'components_count' => (int) $manufacturer->components_count,
|
||||
'tag_color' => $manufacturer->tag_color ? e($manufacturer->tag_color) : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($manufacturer->notes),
|
||||
'created_by' => ($manufacturer->adminuser) ? [
|
||||
'id' => (int) $manufacturer->adminuser->id,
|
||||
|
||||
@@ -26,6 +26,7 @@ class SelectlistTransformer
|
||||
'id' => (int) $select_item->id,
|
||||
'text' => ($select_item->use_text) ? $select_item->use_text : $select_item->name,
|
||||
'image' => ($select_item->use_image) ? $select_item->use_image : null,
|
||||
'tag_color' => ($select_item->tag_color) ? $select_item->tag_color : null,
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ class SuppliersTransformer
|
||||
'licenses_count' => (int) $supplier->licenses_count,
|
||||
'consumables_count' => (int) $supplier->consumables_count,
|
||||
'components_count' => (int) $supplier->components_count,
|
||||
'tag_color' => $supplier->tag_color ? e($supplier->tag_color) : null,
|
||||
'notes' => ($supplier->notes) ? Helper::parseEscapedMarkedownInline($supplier->notes) : null,
|
||||
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
|
||||
'created_by' => $supplier->adminuser ? [
|
||||
|
||||
@@ -57,6 +57,7 @@ class UsersTransformer
|
||||
'department' => ($user->department) ? [
|
||||
'id' => (int) $user->department->id,
|
||||
'name'=> e($user->department->name),
|
||||
'tag_color' => ($user->department->tag_color) ? e($user->department->tag_color) : null,
|
||||
] : null,
|
||||
'department_manager' => ($user->department?->manager) ? [
|
||||
'id' => (int) $user->department->manager->id,
|
||||
@@ -65,6 +66,7 @@ class UsersTransformer
|
||||
'location' => ($user->userloc) ? [
|
||||
'id' => (int) $user->userloc->id,
|
||||
'name'=> e($user->userloc->name),
|
||||
'tag_color'=> ($user->userloc->tag_color) ? e($user->userloc->tag_color) : null,
|
||||
] : null,
|
||||
'notes'=> Helper::parseEscapedMarkedownInline($user->notes),
|
||||
'role' => $role,
|
||||
@@ -80,7 +82,11 @@ class UsersTransformer
|
||||
'consumables_count' => (int) $user->consumables_count,
|
||||
'manages_users_count' => (int) $user->manages_users_count,
|
||||
'manages_locations_count' => (int) $user->manages_locations_count,
|
||||
'company' => ($user->company) ? ['id' => (int) $user->company->id, 'name'=> e($user->company->name)] : null,
|
||||
'company' => ($user->company) ? [
|
||||
'id' => (int) $user->company->id,
|
||||
'name'=> e($user->company->name),
|
||||
'tag_color'=> ($user->company->tag_color) ? e($user->company->tag_color) : null,
|
||||
] : null,
|
||||
'created_by' => ($user->createdBy) ? [
|
||||
'id' => (int) $user->createdBy->id,
|
||||
'name'=> e($user->createdBy->display_name),
|
||||
|
||||
18
app/Mail/BaseMailable.php
Normal file
18
app/Mail/BaseMailable.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Headers;
|
||||
|
||||
class BaseMailable extends Mailable
|
||||
{
|
||||
public function headers(): Headers
|
||||
{
|
||||
return new Headers(
|
||||
text: [
|
||||
'X-Auto-Response-Suppress' => 'OOF, DR, RN, NRN, AutoReply',
|
||||
'X-System-Sender' => 'Snipe-IT',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,12 @@ use App\Models\Accessory;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckinAccessoryMail extends Mailable
|
||||
class CheckinAccessoryMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -7,15 +7,13 @@ use App\Models\Asset;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckinAssetMail extends Mailable
|
||||
class CheckinAssetMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -7,14 +7,12 @@ use App\Models\Component;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckinComponentMail extends Mailable
|
||||
class CheckinComponentMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -6,14 +6,12 @@ use App\Models\LicenseSeat;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckinLicenseMail extends Mailable
|
||||
class CheckinLicenseMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -5,13 +5,11 @@ namespace App\Mail;
|
||||
use App\Models\CheckoutAcceptance;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckoutAcceptanceResponseMail extends Mailable
|
||||
class CheckoutAcceptanceResponseMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -8,15 +8,13 @@ use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CheckoutAccessoryMail extends Mailable
|
||||
class CheckoutAccessoryMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@ use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
@@ -17,7 +15,7 @@ use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckoutAssetMail extends Mailable
|
||||
class CheckoutAssetMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -6,13 +6,12 @@ use App\Models\Component;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckoutComponentMail extends Mailable
|
||||
class CheckoutComponentMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -6,15 +6,12 @@ use App\Models\Consumable;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CheckoutConsumableMail extends Mailable
|
||||
class CheckoutConsumableMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -7,14 +7,12 @@ use App\Models\LicenseSeat;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CheckoutLicenseMail extends Mailable
|
||||
class CheckoutLicenseMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ExpiringAssetsMail extends Mailable
|
||||
class ExpiringAssetsMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ExpiringLicenseMail extends Mailable
|
||||
class ExpiringLicenseMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendUpcomingAuditMail extends Mailable
|
||||
class SendUpcomingAuditMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UnacceptedAssetReminderMail extends Mailable
|
||||
class UnacceptedAssetReminderMail extends BaseMailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -408,6 +408,13 @@ class Asset extends Depreciable
|
||||
);
|
||||
}
|
||||
|
||||
protected function expectedCheckinDiffForHumans(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value, array $attributes) => array_key_exists('expected_checkin', $attributes) ? Carbon::parse($this->expected_checkin)->diffForHumans() : null,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes the asset -> company relationship
|
||||
*
|
||||
|
||||
@@ -73,6 +73,7 @@ class Category extends SnipeModel
|
||||
'alert_on_response',
|
||||
'use_default_eula',
|
||||
'created_by',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Checkoutable
|
||||
$acceptance = $unaccepted;
|
||||
|
||||
$assignee = $acceptance->assignedTo;
|
||||
$company = $unaccepted_row->company ? optional($unaccepted_row->company)->present()->nameUrl() : '';
|
||||
$company = $unaccepted_row?->company?->present()?->nameUrl() ?? '';
|
||||
$category = $model = $name = $tag = '';
|
||||
$type = $acceptance->checkoutable_item_type ?? '';
|
||||
|
||||
@@ -70,10 +70,10 @@ class Checkoutable
|
||||
acceptance: $acceptance,
|
||||
assignee: $assignee,
|
||||
//plain text for CSVs
|
||||
plain_text_category: ($unaccepted_row->model?->category?->name ?? $unaccepted_row->license->category?->name ?? $unaccepted_row->category?->name ?? ''),
|
||||
plain_text_model: ($unaccepted_row->model?->name ?? $unaccepted_row->model_number ?? ''),
|
||||
plain_text_name: ($unaccepted_row->name ?? $unaccepted_row->license?->name ?? ''),
|
||||
plain_text_company: ($unaccepted_row->company)->name ?? $unaccepted_row->license->company?->name ?? '',
|
||||
plain_text_category: $unaccepted_row?->model?->category?->name ?? $unaccepted_row?->license?->category?->name ?? $unaccepted_row?->category?->name ?? '',
|
||||
plain_text_model: $unaccepted_row?->model?->name ?? $unaccepted_row?->model_number ?? '',
|
||||
plain_text_name: $unaccepted_row?->name ?? $unaccepted_row?->license?->name ?? '',
|
||||
plain_text_company: $unaccepted_row?->company->name ?? $unaccepted_row?->license?->company?->name ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ final class Company extends SnipeModel
|
||||
'fax',
|
||||
'email',
|
||||
'created_by',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use App\Models\Traits\CompanyableTrait;
|
||||
use App\Models\Traits\Searchable;
|
||||
use App\Presenters\Presentable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
@@ -22,7 +23,10 @@ class Department extends SnipeModel
|
||||
*/
|
||||
protected $injectUniqueIdentifier = true;
|
||||
|
||||
use ValidatingTrait, UniqueUndeletedTrait;
|
||||
protected $presenter = \App\Presenters\DepartmentPresenter::class;
|
||||
|
||||
|
||||
use ValidatingTrait, UniqueUndeletedTrait, Presentable;
|
||||
|
||||
protected $casts = [
|
||||
'manager_id' => 'integer',
|
||||
@@ -53,6 +57,7 @@ class Department extends SnipeModel
|
||||
'location_id',
|
||||
'company_id',
|
||||
'manager_id',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
|
||||
110
app/Models/Labels/Sheets/Avery/L4736.php
Normal file
110
app/Models/Labels/Sheets/Avery/L4736.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L4736 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 31.70;
|
||||
private const COLUMN2_X = 167.92;
|
||||
private const ROW1_Y = 53.00;
|
||||
private const ROW2_Y = 112.8;
|
||||
private const LABEL_W = 122.24;
|
||||
private const LABEL_H = 66.5;
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth()
|
||||
{
|
||||
return $this->pageWidth;
|
||||
}
|
||||
public function getPageHeight()
|
||||
{
|
||||
return $this->pageHeight;
|
||||
}
|
||||
|
||||
public function getPageMarginTop()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginBottom()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginLeft()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
public function getPageMarginRight()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getRows()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
public function getLabelColumnSpacing()
|
||||
{
|
||||
return $this->columnSpacing;
|
||||
}
|
||||
public function getLabelRowSpacing()
|
||||
{
|
||||
return $this->rowSpacing;
|
||||
}
|
||||
|
||||
public function getLabelWidth()
|
||||
{
|
||||
return $this->labelWidth;
|
||||
}
|
||||
public function getLabelHeight()
|
||||
{
|
||||
return $this->labelHeight;
|
||||
}
|
||||
|
||||
public function getLabelBorder()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
121
app/Models/Labels/Sheets/Avery/L4736_A.php
Normal file
121
app/Models/Labels/Sheets/Avery/L4736_A.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L4736_A extends L4736
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.80;
|
||||
private const TAG_SIZE = 4.80;
|
||||
private const TITLE_SIZE = 3.00;
|
||||
private const TITLE_MARGIN = 1.80;
|
||||
private const LABEL_SIZE = 2.8;
|
||||
private const LABEL_MARGIN = - 0.45;
|
||||
private const FIELD_SIZE = 3.80;
|
||||
private const FIELD_MARGIN = 0.20;
|
||||
|
||||
public function getUnit()
|
||||
{
|
||||
return 'mm';
|
||||
}
|
||||
|
||||
public function getLabelMarginTop()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginBottom()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginLeft()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginRight()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
|
||||
public function getSupportAssetTag()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupport1DBarcode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupport2DBarcode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupportFields()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getSupportLogo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupportTitle()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function preparePDF($pdf)
|
||||
{
|
||||
}
|
||||
|
||||
public function write($pdf, $record)
|
||||
{
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
|
||||
}
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$barcodeSize = $usableHeight;
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,110 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L6009 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 31.70;
|
||||
private const COLUMN2_X = 167.92;
|
||||
private const ROW1_Y = 53.00;
|
||||
private const ROW2_Y = 112.8;
|
||||
private const LABEL_W = 122.24;
|
||||
private const LABEL_H = 66.5;
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth()
|
||||
{
|
||||
return $this->pageWidth;
|
||||
}
|
||||
public function getPageHeight()
|
||||
{
|
||||
return $this->pageHeight;
|
||||
}
|
||||
|
||||
public function getPageMarginTop()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginBottom()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginLeft()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
public function getPageMarginRight()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getRows()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
public function getLabelColumnSpacing()
|
||||
{
|
||||
return $this->columnSpacing;
|
||||
}
|
||||
public function getLabelRowSpacing()
|
||||
{
|
||||
return $this->rowSpacing;
|
||||
}
|
||||
|
||||
public function getLabelWidth()
|
||||
{
|
||||
return $this->labelWidth;
|
||||
}
|
||||
public function getLabelHeight()
|
||||
{
|
||||
return $this->labelHeight;
|
||||
}
|
||||
|
||||
public function getLabelBorder()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L6009 extends RectangleSheet
|
||||
{
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
// Convert mm to pt (1 mm = 2.83465 pt)
|
||||
private const LABEL_W = 129.54;
|
||||
private const LABEL_H = 60.09;
|
||||
private const COLUMN1_X = 22.67;
|
||||
private const ROW1_Y = 37.41;
|
||||
private const COLUMN_SPACING = 14.17;
|
||||
private const ROW_SPACING = 2.26;
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$this->columnSpacing = Helper::convertUnit(self::COLUMN_SPACING, 'pt', $this->getUnit());
|
||||
$this->rowSpacing = Helper::convertUnit(self::ROW_SPACING, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth() { return $this->pageWidth; }
|
||||
public function getPageHeight() { return $this->pageHeight; }
|
||||
|
||||
public function getPageMarginTop() { return $this->pageMarginTop; }
|
||||
public function getPageMarginBottom() { return $this->pageMarginTop; }
|
||||
public function getPageMarginLeft() { return $this->pageMarginLeft; }
|
||||
public function getPageMarginRight() { return $this->pageMarginLeft; }
|
||||
|
||||
public function getColumns() { return 4; }
|
||||
public function getRows() { return 12; }
|
||||
|
||||
public function getLabelColumnSpacing(){ return $this->columnSpacing; }
|
||||
public function getLabelRowSpacing() { return $this->rowSpacing; }
|
||||
|
||||
public function getLabelWidth() { return $this->labelWidth; }
|
||||
public function getLabelHeight() { return $this->labelHeight; }
|
||||
|
||||
public function getLabelBorder() { return 0; }
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,121 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L6009_A extends L6009
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.80;
|
||||
private const TAG_SIZE = 4.80;
|
||||
private const TITLE_SIZE = 3.00;
|
||||
private const TITLE_MARGIN = 1.80;
|
||||
private const LABEL_SIZE = 2.8;
|
||||
private const LABEL_MARGIN = - 0.45;
|
||||
private const FIELD_SIZE = 3.80;
|
||||
private const FIELD_MARGIN = 0.20;
|
||||
|
||||
public function getUnit()
|
||||
{
|
||||
return 'mm';
|
||||
}
|
||||
|
||||
public function getLabelMarginTop()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginBottom()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginLeft()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginRight()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
|
||||
public function getSupportAssetTag()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupport1DBarcode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupport2DBarcode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupportFields()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getSupportLogo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupportTitle()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function preparePDF($pdf)
|
||||
{
|
||||
}
|
||||
|
||||
public function write($pdf, $record)
|
||||
{
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
|
||||
}
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$barcodeSize = $usableHeight;
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
class L6009_A extends L6009
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.80;
|
||||
private const TAG_SIZE = 4.80;
|
||||
private const TITLE_SIZE = 3.00;
|
||||
private const TITLE_MARGIN = 1.80;
|
||||
private const LABEL_SIZE = 2.8;
|
||||
private const LABEL_MARGIN = -0.45;
|
||||
private const FIELD_SIZE = 3.80;
|
||||
private const FIELD_MARGIN = 0.20;
|
||||
|
||||
public function getUnit() { return 'mm'; }
|
||||
|
||||
public function getLabelMarginTop() { return 0.06; }
|
||||
public function getLabelMarginBottom() { return 0.06; }
|
||||
public function getLabelMarginLeft() { return 0.06; }
|
||||
public function getLabelMarginRight() { return 0.06; }
|
||||
|
||||
public function getSupportAssetTag() { return true; }
|
||||
public function getSupport1DBarcode() { return false; }
|
||||
public function getSupport2DBarcode() { return true; }
|
||||
public function getSupportFields() { return 4; }
|
||||
public function getSupportLogo() { return false; }
|
||||
public function getSupportTitle() { return false; }
|
||||
|
||||
public function preparePDF($pdf) {}
|
||||
|
||||
public function write($pdf, $record)
|
||||
{
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
}
|
||||
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
|
||||
$barcodeSize = $usableHeight;
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -77,6 +77,7 @@ class Location extends SnipeModel
|
||||
'manager_id',
|
||||
'image',
|
||||
'company_id',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
protected $hidden = ['user_id'];
|
||||
|
||||
@@ -53,6 +53,7 @@ class Manufacturer extends SnipeModel
|
||||
'support_url',
|
||||
'url',
|
||||
'warranty_lookup_url',
|
||||
'tag_color',
|
||||
'notes',
|
||||
];
|
||||
|
||||
|
||||
@@ -4,17 +4,21 @@ namespace App\Models;
|
||||
|
||||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use App\Models\Traits\HasUploads;
|
||||
use App\Models\Traits\Loggable;
|
||||
use App\Models\Traits\Searchable;
|
||||
use App\Presenters\Presentable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use \Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use App\Models\Traits\Loggable;
|
||||
class Supplier extends SnipeModel
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
use HasUploads;
|
||||
use Presentable;
|
||||
|
||||
protected $presenter = \App\Presenters\SupplierPresenter::class;
|
||||
|
||||
protected $table = 'suppliers';
|
||||
|
||||
@@ -66,7 +70,7 @@ class Supplier extends SnipeModel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name', 'address', 'address2', 'city', 'state', 'country', 'zip', 'phone', 'fax', 'email', 'contact', 'url', 'notes'];
|
||||
protected $fillable = ['name', 'address', 'address2', 'city', 'state', 'country', 'zip', 'phone', 'fax', 'email', 'contact', 'url', 'tag_color', 'notes'];
|
||||
|
||||
/**
|
||||
* Eager load counts
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
namespace App\Notifications;
|
||||
|
||||
use AllowDynamicProperties;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties] class AcceptanceAssetAcceptedNotification extends Notification
|
||||
#[AllowDynamicProperties]
|
||||
class AcceptanceItemAcceptedNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -77,9 +76,14 @@ use Illuminate\Notifications\Notification;
|
||||
'assigned_to' => $this->assigned_to,
|
||||
'company_name' => $this->company_name,
|
||||
'qty' => $this->qty,
|
||||
'intro_text' => trans('mail.acceptance_asset_accepted'),
|
||||
'intro_text' => trans('mail.acceptance_accepted_greeting', ['user' => $this->assigned_to, 'item' => $this->item_name]),
|
||||
])
|
||||
->subject(trans('mail.acceptance_asset_accepted'));
|
||||
->subject('✅ '.trans('mail.acceptance_accepted', ['user' => $this->assigned_to, 'item' => $this->item_name]))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
@@ -8,8 +8,10 @@ use App\Models\Setting;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties] class AcceptanceAssetAcceptedToUserNotification extends Notification
|
||||
#[AllowDynamicProperties]
|
||||
class AcceptanceItemAcceptedToUserNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -73,7 +75,12 @@ use Illuminate\Notifications\Notification;
|
||||
'intro_text' => trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]),
|
||||
])
|
||||
->attach($pdf_path)
|
||||
->subject(trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]));
|
||||
->subject('✅ '. trans_choice('mail.acceptance_asset_accepted_to_user', $this->qty, ['qty' => $this->qty, 'site_name' => $this->settings->site_name]))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
@@ -2,15 +2,14 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
class AcceptanceAssetDeclinedNotification extends Notification
|
||||
#[AllowDynamicProperties]
|
||||
class AcceptanceItemDeclinedNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -21,6 +20,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
|
||||
*/
|
||||
public function __construct($params)
|
||||
{
|
||||
$this->item_name = $params['item_name'];
|
||||
$this->item_tag = $params['item_tag'];
|
||||
$this->item_model = $params['item_model'];
|
||||
$this->item_serial = $params['item_serial'];
|
||||
@@ -64,6 +64,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
|
||||
$message = (new MailMessage)->markdown('notifications.markdown.asset-acceptance',
|
||||
[
|
||||
'item_tag' => $this->item_tag,
|
||||
'item_name' => $this->item_name,
|
||||
'item_model' => $this->item_model,
|
||||
'item_serial' => $this->item_serial,
|
||||
'item_status' => $this->item_status,
|
||||
@@ -73,9 +74,14 @@ class AcceptanceAssetDeclinedNotification extends Notification
|
||||
'company_name' => $this->company_name,
|
||||
'qty' => $this->qty,
|
||||
'admin' => $this->admin,
|
||||
'intro_text' => trans('mail.acceptance_asset_declined'),
|
||||
'intro_text' => trans('mail.acceptance_declined_greeting'),
|
||||
])
|
||||
->subject(trans('mail.acceptance_asset_declined'));
|
||||
->subject('⚠️ '.trans('mail.acceptance_declined', ['user' => $this->assigned_to, 'item' => $this->item_name]))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
@@ -10,10 +10,17 @@ use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use NotificationChannels\GoogleChat\Card;
|
||||
use NotificationChannels\GoogleChat\GoogleChatChannel;
|
||||
use NotificationChannels\GoogleChat\GoogleChatMessage;
|
||||
use NotificationChannels\GoogleChat\Section;
|
||||
use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties] class AuditNotification extends Notification
|
||||
#[AllowDynamicProperties]
|
||||
class AuditNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
/**
|
||||
@@ -31,6 +38,10 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
//
|
||||
$this->settings = Setting::getSettings();
|
||||
$this->params = $params;
|
||||
$item = $params['item'];
|
||||
if (!$item || !is_object($item)) {
|
||||
throw new \InvalidArgumentException('Notification requires a valid item.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,6 +60,10 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||
}
|
||||
if (Setting::getSettings()->webhook_selected == 'google' && Setting::getSettings()->webhook_endpoint) {
|
||||
Log::debug('using google webhook');
|
||||
$notifyBy[] = GoogleChatChannel::class;
|
||||
}
|
||||
return $notifyBy;
|
||||
}
|
||||
|
||||
@@ -82,16 +97,21 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
$location = $params['location'] ?? '';
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
//if somehow a notification triggers without an item, bail out.
|
||||
if(!$item || !is_object($item)){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!Str::contains($setting->webhook_endpoint, 'workflows')) {
|
||||
return MicrosoftTeamsMessage::create()
|
||||
->to($setting->webhook_endpoint)
|
||||
->type('success')
|
||||
->title(class_basename(get_class($params['item'])) .' '.trans('general.audited'))
|
||||
->title(class_basename($item).' '.trans('general.audited'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(trans('mail.asset'), $item)
|
||||
->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->display_name);
|
||||
}
|
||||
$message = class_basename(get_class($params['item'])) . ' Audited By '.$admin_user->display_name;
|
||||
$message = class_basename(get_class($params['item'])) . trans('general.audited_by').' '.$admin_user->display_name;
|
||||
$details = [
|
||||
trans('mail.asset') => htmlspecialchars_decode($item->display_name),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
@@ -99,4 +119,35 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
];
|
||||
return [$message, $details];
|
||||
}
|
||||
public function toGoogleChat()
|
||||
{
|
||||
$item = $this->params['item'] ?? null;
|
||||
$admin_user = $this->params['admin'] ?? null;
|
||||
$note = $this->params['note'] ?? '';
|
||||
$setting = $this->settings ?? Setting::getSettings();
|
||||
|
||||
$title = '<strong>' . class_basename($item) . ' ' . trans('general.audited') . '</strong>';
|
||||
$subtitle = htmlspecialchars_decode($item->display_name ?? '');
|
||||
\Log::debug('Google Chat audit payload', [
|
||||
'title' => $title,
|
||||
'subtitle' => $subtitle,
|
||||
'admin' => $admin_user->display_name,
|
||||
'note' => $note,
|
||||
]);
|
||||
return GoogleChatMessage::create()
|
||||
->to($setting->webhook_endpoint)
|
||||
->card(
|
||||
Card::create()
|
||||
->header($title, $subtitle)
|
||||
->section(
|
||||
Section::create(
|
||||
KeyValue::create(
|
||||
trans('general.audited_by'),
|
||||
$admin_user?->display_name ?? '',
|
||||
$note ?? ''
|
||||
)->onClick(route('hardware.show', $item->id))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ use NotificationChannels\GoogleChat\Section;
|
||||
use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckinAccessoryNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -20,6 +20,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
#[AllowDynamicProperties]
|
||||
class CheckinAssetNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -18,6 +18,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckinComponentNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -19,6 +19,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckinLicenseSeatNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -18,7 +18,9 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckoutAccessoryNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -210,6 +212,11 @@ class CheckoutAccessoryNotification extends Notification
|
||||
'accept_url' => $accept_url,
|
||||
'checkout_qty' => $this->checkout_qty,
|
||||
])
|
||||
->subject(trans('mail.Confirm_accessory_delivery'));
|
||||
->subject(trans('mail.Confirm_accessory_delivery'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use Osama\LaravelTeamsNotification\Logging\TeamsLoggingChannel;
|
||||
use Osama\LaravelTeamsNotification\TeamsNotification;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckoutAssetNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -20,6 +20,7 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckoutComponentNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -20,6 +20,7 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckoutConsumableNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -19,6 +19,7 @@ use NotificationChannels\GoogleChat\Widgets\KeyValue;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
|
||||
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CheckoutLicenseSeatNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Notifications;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class CurrentInventory extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -45,7 +47,12 @@ class CurrentInventory extends Notification
|
||||
'licenses' => $this->user->licenses,
|
||||
'consumables' => $this->user->consumables,
|
||||
])
|
||||
->subject(trans('mail.inventory_report'));
|
||||
->subject(trans('mail.inventory_report'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Notifications;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class ExpectedCheckinAdminNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -48,7 +50,12 @@ class ExpectedCheckinAdminNotification extends Notification
|
||||
[
|
||||
'assets' => $this->assets,
|
||||
])
|
||||
->subject(trans('mail.Expected_Checkin_Report'));
|
||||
->subject('⏰'.trans('mail.Expected_Checkin_Report'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class ExpectedCheckinNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -47,14 +50,22 @@ class ExpectedCheckinNotification extends Notification
|
||||
*/
|
||||
public function toMail()
|
||||
{
|
||||
$today = Carbon::now();
|
||||
|
||||
$message = (new MailMessage)->markdown('notifications.markdown.expected-checkin',
|
||||
[
|
||||
'expected_checkin_date' => $this->params->expected_checkin,
|
||||
'date' => Helper::getFormattedDateObject($this->params->expected_checkin, 'date', false),
|
||||
'asset' => $this->params->display_name,
|
||||
'serial' => $this->params->serial,
|
||||
'asset_tag' => $this->params->asset_tag,
|
||||
])
|
||||
->subject(trans('mail.Expected_Checkin_Notification', ['name' => $this->params->display_name]));
|
||||
->subject('⏰'. ($today > $this->params->expected_checkin) ? trans('mail.Expected_Checkin_Notification_Pastdue', ['name' => $this->params->display_name]) : trans('mail.Expected_Checkin_Notification', ['name' => $this->params->display_name]))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Notifications;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class ExpiringAssetsNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -51,7 +53,12 @@ class ExpiringAssetsNotification extends Notification
|
||||
'assets' => $this->assets,
|
||||
'threshold' => $this->threshold,
|
||||
])
|
||||
->subject(trans('mail.Expiring_Assets_Report'));
|
||||
->subject('⏰'.trans('mail.Expiring_Assets_Report'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Notifications;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class ExpiringLicenseNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -52,7 +54,12 @@ class ExpiringLicenseNotification extends Notification
|
||||
'licenses' => $this->licenses,
|
||||
'threshold' => $this->threshold,
|
||||
])
|
||||
->subject(trans('mail.Expiring_Licenses_Report'));
|
||||
->subject('⏰'.trans('mail.Expiring_Licenses_Report'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ namespace App\Notifications;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class FirstAdminNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -45,7 +47,12 @@ class FirstAdminNotification extends Notification
|
||||
public function toMail()
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(trans('mail.welcome', ['name' => $this->_data['first_name'].' '.$this->_data['last_name']]))
|
||||
->markdown('notifications.FirstAdmin', $this->_data);
|
||||
->subject('👋 '.trans('mail.welcome', ['name' => $this->_data['first_name'].' '.$this->_data['last_name']]))
|
||||
->markdown('notifications.FirstAdmin', $this->_data)
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use AllowDynamicProperties;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class InventoryAlert extends Notification
|
||||
@@ -52,7 +53,12 @@ class InventoryAlert extends Notification
|
||||
'threshold' => $this->threshold,
|
||||
]
|
||||
)
|
||||
->subject(trans('mail.Low_Inventory_Report'));
|
||||
->subject('⚠️ '.trans('mail.Low_Inventory_Report'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class MailTest extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -39,7 +40,12 @@ class MailTest extends Notification
|
||||
public function toMail()
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(trans('mail.test_email'))
|
||||
->markdown('notifications.Test');
|
||||
->subject('👋 '.trans('mail.test_email'))
|
||||
->markdown('notifications.Test')
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class RequestAssetCancelation extends Notification
|
||||
{
|
||||
/**
|
||||
@@ -124,7 +126,12 @@ class RequestAssetCancelation extends Notification
|
||||
'expected_checkin' => $this->expected_checkin,
|
||||
'intro_text' => trans('mail.a_user_canceled'),
|
||||
])
|
||||
->subject(trans('Item Request Canceled'));
|
||||
->subject('⚠️ '.trans('general.request_canceled'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ use App\Models\Setting;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class RequestAssetNotification extends Notification
|
||||
{
|
||||
/**
|
||||
@@ -118,7 +120,12 @@ class RequestAssetNotification extends Notification
|
||||
'intro_text' => trans('mail.a_user_requested'),
|
||||
'qty' => $this->item_quantity,
|
||||
])
|
||||
->subject(trans('mail.Item_Requested'));
|
||||
->subject('👀 '.trans('mail.Item_Requested'))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class SendUpcomingAuditNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -45,7 +47,12 @@ class SendUpcomingAuditNotification extends Notification
|
||||
'assets' => $this->assets,
|
||||
'threshold' => $this->threshold,
|
||||
])
|
||||
->subject(trans_choice('mail.upcoming-audits', $this->assets->count(), ['count' => $this->assets->count(), 'threshold' => $this->threshold]));
|
||||
->subject('⏰'.trans_choice('mail.upcoming-audits', $this->assets->count(), ['count' => $this->assets->count(), 'threshold' => $this->threshold]))
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use App\Models\User;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
#[AllowDynamicProperties]
|
||||
class WelcomeNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
@@ -43,7 +45,12 @@ class WelcomeNotification extends Notification
|
||||
{
|
||||
|
||||
return (new MailMessage())
|
||||
->subject(trans('mail.welcome', ['name' => $this->user->first_name.' '.$this->user->last_name]))
|
||||
->markdown('notifications.Welcome', $this->user->toArray());
|
||||
->subject('👋 '.trans('mail.welcome', ['name' => $this->user->first_name.' '.$this->user->last_name]))
|
||||
->markdown('notifications.Welcome', $this->user->toArray())
|
||||
->withSymfonyMessage(function (Email $message) {
|
||||
$message->getHeaders()->addTextHeader(
|
||||
'X-System-Sender', 'Snipe-IT'
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user