mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-14 01:24:06 -08:00
9adb2c24f3
commitdddbf27d78
Author: snipe <snipe@snipe.net> Date: Wed Sep 18 14:18:52 2024 +0100 Updated language strings Signed-off-by: snipe <snipe@snipe.net> commitfcefcc8184
Merge:04bb3eec8
3519a82dd
Author: snipe <snipe@snipe.net> Date: Wed Sep 18 13:44:44 2024 +0100 Merge pull request #15512 from marcusmoore/testing/fmcs Added tests for delete methods in api commit04bb3eec83
Merge:154d5d8d9
f963b9a19
Author: snipe <snipe@snipe.net> Date: Wed Sep 18 13:41:37 2024 +0100 Merge pull request #15521 from uberbrady/improve_country_selector Fix selected-index of Countries drop-down [fd-44144] commitf963b9a19f
Author: Brady Wetherington <bwetherington@grokability.com> Date: Wed Sep 18 13:24:26 2024 +0100 Fix selected-index of Countries drop-down commit154d5d8d91
Merge:6c996b775
9e5f6d656
Author: snipe <snipe@snipe.net> Date: Tue Sep 17 23:40:25 2024 +0100 Merge pull request #15491 from uberbrady/numeric_prefixes_add_multiple_assets [Fixes fd-43940] Improve multi-asset create when using numeric prefixes to asset_tags commit3519a82ddd
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 16:55:20 2024 -0700 Fix name: TestsFullMultipleCompaniesSupport commita629df07bf
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:49:08 2024 -0700 Implement interfaces on existing test classes commit9a13fcab23
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:38:38 2024 -0700 Pluralize commitf5705a1dde
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:34:55 2024 -0700 More unification commitf325c4afdb
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:32:38 2024 -0700 Unify assertion method commit1fddacd7d0
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:25:11 2024 -0700 Re-order test methods commit4af893df61
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 14:20:24 2024 -0700 Improve assertions commitb8b3f91ce4
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 13:55:18 2024 -0700 Formatting commit7f40f55343
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 13:52:02 2024 -0700 Add tests for delete supplier endpoint commitb06e8d442d
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 13:37:08 2024 -0700 Add tests for delete status label endpoint commitc269184c60
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 13:29:41 2024 -0700 Add tests for delete predefined kit endpoint commit53c673dee2
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 13:13:12 2024 -0700 Add tests for delete manufacturer endpoint commit50730fc4fb
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 12:37:18 2024 -0700 Add tests for delete location endpoint commit60a54cee79
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 12:33:30 2024 -0700 Add tests for delete license endpoint commit446e962a50
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 10:38:51 2024 -0700 Add tests for delete group endpoint commit79a4bb7316
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 10:35:44 2024 -0700 Add tests for delete depreciation endpoint commit2f76c1bc5b
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 10:33:21 2024 -0700 Add assertion commit38b9f4a438
Author: Marcus Moore <contact@marcusmoore.io> Date: Mon Sep 16 10:29:20 2024 -0700 Add tests for delete departments endpoint commit3105f53aff
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 16:54:29 2024 -0700 Add tests for delete custom fieldsets endpoint commit2047cfed09
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 16:20:32 2024 -0700 Add tests for delete custom fields endpoint commite3268d32df
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 16:00:02 2024 -0700 Add tests for delete consumable endpoint commit6df8b0ac0e
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 15:52:07 2024 -0700 Add tests for delete component endpoint commit910f13c1f7
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 15:38:30 2024 -0700 Add tests for delete companies endpoint commit8ce2512f55
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:54:44 2024 -0700 Add tests for delete category endpoint commit0ec415d4d0
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:46:22 2024 -0700 Clean up commit2044570e95
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:39:36 2024 -0700 Add tests for delete asset model endpoint commitb336c6273d
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:32:42 2024 -0700 Pluralize test classes commit5299b3e9f0
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:29:44 2024 -0700 Remove code handled by CompanyableChildTrait commit872b76b45f
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:29:10 2024 -0700 Add tests for delete asset maintenance endpoint commit275cf4630e
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:16:37 2024 -0700 Add tests for delete asset endpoint commit5c2660bd34
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 13:02:32 2024 -0700 Introduce interface commitc7ae9d9dfa
Author: Marcus Moore <contact@marcusmoore.io> Date: Thu Sep 12 12:58:47 2024 -0700 Add tests for delete accessory endpoint commit9e5f6d656a
Author: Brady Wetherington <bwetherington@grokability.com> Date: Wed Sep 11 15:45:01 2024 +0100 Improve multi-asset create when using numeric prefixes to asset_tags Signed-off-by: snipe <snipe@snipe.net>
311 lines
11 KiB
PHP
311 lines
11 KiB
PHP
<?php
|
|
/**
|
|
* Macro helpers
|
|
*/
|
|
|
|
/**
|
|
* Locale macro
|
|
* Generates the dropdown menu of available languages
|
|
*/
|
|
Form::macro('locales', function ($name = 'locale', $selected = null, $class = null, $id = null) {
|
|
|
|
$idclause = (!is_null($id)) ? $id : '';
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width:100%"'.$idclause.' aria-label="'.$name.'" data-placeholder="'.trans('localizations.select_language').'">';
|
|
$select .= '<option value="" role="option">'.trans('localizations.select_language').'</option>';
|
|
|
|
// Pull the autoglossonym array from the localizations translation file
|
|
foreach (trans('localizations.languages') as $abbr => $locale) {
|
|
$select .= '<option value="'.$abbr.'"'.(($selected == $abbr) ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$locale.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
/**
|
|
* Country macro
|
|
* Generates the dropdown menu of countries for the profile form
|
|
*/
|
|
Form::macro('countries', function ($name = 'country', $selected = null, $class = null, $id = null) {
|
|
|
|
$idclause = (!is_null($id)) ? $id : '';
|
|
|
|
// Pull the autoglossonym array from the localizations translation file
|
|
$countries_array = trans('localizations.countries');
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width:100%" '.$idclause.' aria-label="'.$name.'" data-placeholder="'.trans('localizations.select_country').'" data-allow-clear="true" data-tags="true">';
|
|
$select .= '<option value="" role="option">'.trans('localizations.select_country').'</option>';
|
|
|
|
foreach ($countries_array as $abbr => $country) {
|
|
|
|
// We have to handle it this way to handle deprecation warnings since you can't strtoupper on null
|
|
if ($abbr!='') {
|
|
$abbr = strtoupper($abbr);
|
|
}
|
|
|
|
// Loop through the countries configured in the localization file
|
|
$select .= '<option value="' . $abbr . '" role="option" ' . (($selected == $abbr) ? ' selected="selected" aria-selected="true"' : ' aria-selected="false"') . '>' . $country . '</option> ';
|
|
|
|
}
|
|
|
|
// If the country value doesn't exist in the array, add it as a new option and select it so we don't drop that data
|
|
if (!array_key_exists($selected, $countries_array)) {
|
|
$select .= '<option value="' . $selected . '" selected="selected" role="option" aria-selected="true">' . $selected .' *</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('date_display_format', function ($name = 'date_display_format', $selected = null, $class = null) {
|
|
$formats = [
|
|
'Y-m-d',
|
|
'D M d, Y',
|
|
'M j, Y',
|
|
'd M, Y',
|
|
'm/d/Y',
|
|
'n/d/y',
|
|
'd/m/Y',
|
|
'd.m.Y',
|
|
'Y.m.d.',
|
|
];
|
|
|
|
foreach ($formats as $format) {
|
|
$date_display_formats[$format] = Carbon::parse(date('Y-m-d'))->format($format);
|
|
}
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:100%" aria-label="'.$name.'">';
|
|
foreach ($date_display_formats as $format => $date_display_format) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'">'.$date_display_format.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('time_display_format', function ($name = 'time_display_format', $selected = null, $class = null) {
|
|
$formats = [
|
|
'g:iA',
|
|
'h:iA',
|
|
'H:i',
|
|
];
|
|
|
|
$datetime = date("y-m-d").' 14:00:00';
|
|
foreach ($formats as $format) {
|
|
$time_display_formats[$format] = Carbon::parse($datetime)->format($format);
|
|
}
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:150px" aria-label="'.$name.'">';
|
|
foreach ($time_display_formats as $format => $time_display_format) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$time_display_format.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('digit_separator', function ($name = 'digit_separator', $selected = null, $class = null) {
|
|
$formats = [
|
|
'1,234.56',
|
|
'1.234,56',
|
|
];
|
|
|
|
foreach ($formats as $format) {
|
|
}
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:120px">';
|
|
foreach ($formats as $format_inner) {
|
|
$select .= '<option value="'.$format_inner.'"'.($selected == $format_inner ? ' selected="selected"' : '').'>'.$format_inner.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
|
|
Form::macro('name_display_format', function ($name = 'name_display_format', $selected = null, $class = null) {
|
|
$formats = [
|
|
'first_last' => trans('general.firstname_lastname_display'),
|
|
'last_first' => trans('general.lastname_firstname_display'),
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
/**
|
|
* Barcode macro
|
|
* Generates the dropdown menu of available 1D barcodes
|
|
*/
|
|
Form::macro('alt_barcode_types', function ($name = 'alt_barcode', $selected = null, $class = null) {
|
|
$barcode_types = [
|
|
'C128',
|
|
'C39',
|
|
'PDF417',
|
|
'EAN5',
|
|
'EAN13',
|
|
'UPCA',
|
|
'UPCE',
|
|
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" aria-label="'.$name.'">';
|
|
foreach ($barcode_types as $barcode_type) {
|
|
$select .= '<option value="'.$barcode_type.'"'.($selected == $barcode_type ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$barcode_type.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
/**
|
|
* Barcode macro
|
|
* Generates the dropdown menu of available 2D barcodes
|
|
*/
|
|
Form::macro('barcode_types', function ($name = 'barcode_type', $selected = null, $class = null) {
|
|
$barcode_types = [
|
|
'QRCODE',
|
|
'DATAMATRIX',
|
|
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" aria-label="'.$name.'">';
|
|
foreach ($barcode_types as $barcode_type) {
|
|
$select .= '<option value="'.$barcode_type.'"'.($selected == $barcode_type ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$barcode_type.'</option> ';
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('username_format', function ($name = 'username_format', $selected = null, $class = null) {
|
|
$formats = [
|
|
'firstname.lastname' => trans('general.firstname_lastname_format'),
|
|
'firstname' => trans('general.first_name_format'),
|
|
'filastname' => trans('general.filastname_format'),
|
|
'lastnamefirstinitial' => trans('general.lastnamefirstinitial_format'),
|
|
'firstname_lastname' => trans('general.firstname_lastname_underscore_format'),
|
|
'firstinitial.lastname' => trans('general.firstinitial.lastname'),
|
|
'lastname_firstinitial' => trans('general.lastname_firstinitial'),
|
|
'firstnamelastname' => trans('general.firstnamelastname'),
|
|
'firstnamelastinitial' => trans('general.firstnamelastinitial'),
|
|
'lastname.firstname' => trans('general.lastnamefirstname'),
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('two_factor_options', function ($name = 'two_factor_enabled', $selected = null, $class = null) {
|
|
$formats = [
|
|
'' => trans('admin/settings/general.two_factor_disabled'),
|
|
'1' => trans('admin/settings/general.two_factor_optional'),
|
|
'2' => trans('admin/settings/general.two_factor_required'),
|
|
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" aria-label="'.$name.'">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('customfield_elements', function ($name = 'customfield_elements', $selected = null, $class = null) {
|
|
$formats = [
|
|
'text' => 'Text Box',
|
|
'listbox' => 'List Box',
|
|
'textarea' => 'Textarea (multi-line) ',
|
|
'checkbox' => 'Checkbox',
|
|
'radio' => 'Radio Buttons',
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 100%" aria-label="'.$name.'">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('skin', function ($name = 'skin', $selected = null, $class = null) {
|
|
$formats = [
|
|
'blue' => 'Default Blue',
|
|
'blue-dark' => 'Blue (Dark Mode)',
|
|
'green' => 'Green Dark',
|
|
'green-dark' => 'Green (Dark Mode)',
|
|
'red' => 'Red Dark',
|
|
'red-dark' => 'Red (Dark Mode)',
|
|
'orange' => 'Orange Dark',
|
|
'orange-dark' => 'Orange (Dark Mode)',
|
|
'black' => 'Black',
|
|
'black-dark' => 'Black (Dark Mode)',
|
|
'purple' => 'Purple',
|
|
'purple-dark' => 'Purple (Dark Mode)',
|
|
'yellow' => 'Yellow',
|
|
'yellow-dark' => 'Yellow (Dark Mode)',
|
|
'contrast' => 'High Contrast',
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 250px" aria-label="'.$name.'">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|
|
|
|
Form::macro('user_skin', function ($name = 'skin', $selected = null, $class = null) {
|
|
$formats = [
|
|
'' => 'Site Default',
|
|
'blue' => 'Default Blue',
|
|
'blue-dark' => 'Blue (Dark Mode)',
|
|
'green' => 'Green Dark',
|
|
'green-dark' => 'Green (Dark Mode)',
|
|
'red' => 'Red Dark',
|
|
'red-dark' => 'Red (Dark Mode)',
|
|
'orange' => 'Orange Dark',
|
|
'orange-dark' => 'Orange (Dark Mode)',
|
|
'black' => 'Black',
|
|
'black-dark' => 'Black (Dark Mode)',
|
|
'purple' => 'Purple',
|
|
'purple-dark' => 'Purple (Dark Mode)',
|
|
'yellow' => 'Yellow',
|
|
'yellow-dark' => 'Yellow (Dark Mode)',
|
|
'contrast' => 'High Contrast',
|
|
];
|
|
|
|
$select = '<select name="'.$name.'" class="'.$class.'" style="width: 250px">';
|
|
foreach ($formats as $format => $label) {
|
|
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected"' : '').'>'.$label.'</option> '."\n";
|
|
}
|
|
|
|
$select .= '</select>';
|
|
|
|
return $select;
|
|
});
|