snipe-it/resources/macros/macros.php
snipe 87464e6ec0
Merge branch 'develop' into integrations/2020-04-15-v5-merge
# Conflicts:
#	README.md
#	app/Http/Controllers/AccessoriesController.php
#	app/Http/Controllers/Api/AssetsController.php
#	app/Http/Controllers/Api/LicensesController.php
#	app/Http/Controllers/Api/LocationsController.php
#	app/Http/Controllers/Api/SettingsController.php
#	app/Http/Controllers/Api/UsersController.php
#	app/Http/Controllers/AssetModelsController.php
#	app/Http/Controllers/Assets/AssetsController.php
#	app/Http/Controllers/Auth/ForgotPasswordController.php
#	app/Http/Controllers/CategoriesController.php
#	app/Http/Controllers/CompaniesController.php
#	app/Http/Controllers/ComponentsController.php
#	app/Http/Controllers/ConsumablesController.php
#	app/Http/Controllers/CustomFieldsetsController.php
#	app/Http/Controllers/DepartmentsController.php
#	app/Http/Controllers/LicensesController.php
#	app/Http/Controllers/LocationsController.php
#	app/Http/Controllers/ManufacturersController.php
#	app/Http/Controllers/SettingsController.php
#	app/Http/Controllers/SuppliersController.php
#	app/Http/Controllers/UsersController.php
#	app/Http/Requests/AssetRequest.php
#	app/Http/Requests/ImageUploadRequest.php
#	app/Models/LicenseSeat.php
#	app/Models/Location.php
#	app/Models/Setting.php
#	composer.json
#	composer.lock
#	config/database.php
#	config/version.php
#	npm-shrinkwrap.json
#	package.json
#	public/css/AdminLTE.css
#	public/css/AdminLTE.css.map
#	public/css/overrides.css
#	public/css/overrides.css.map
#	public/css/skins/skin-blue-light.css
#	public/css/skins/skin-blue.css
#	public/css/skins/skin-green-dark.min.css
#	public/js/app.js
#	public/js/bootstrap-table.js
#	public/js/bootstrap/js/bootstrap.js
#	public/js/bootstrap/js/bootstrap.min.js
#	public/js/build/all.js
#	public/js/build/vue.js
#	public/js/build/vue.js.map
#	public/js/demo.js
#	public/js/ekko-lightbox.js
#	public/js/ekko-lightbox.min.js
#	public/js/extensions/export/bootstrap-table-export.js
#	public/js/extensions/multiple-sort/bootstrap-table-multiple-sort.js
#	public/js/extensions/multiple-sort/bootstrap-table-multiple-sort.min.js
#	public/js/extensions/toolbar/bootstrap-table-toolbar.min.js
#	public/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
#	public/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js
#	public/js/plugins/timepicker/bootstrap-timepicker.js
#	public/js/plugins/timepicker/bootstrap-timepicker.min.js
#	public/js/vue.js
#	public/mix-manifest.json
#	resources/assets/js/bootstrap-js.js
#	resources/assets/js/bootstrap.min.js
#	resources/assets/js/ekko-lightbox.js
#	resources/assets/js/ekko-lightbox.min.js
#	resources/assets/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js
#	resources/assets/js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js
#	resources/assets/js/plugins/chartjs/Chart.js
#	resources/assets/js/plugins/timepicker/bootstrap-timepicker.js
#	resources/assets/js/plugins/timepicker/bootstrap-timepicker.min.js
#	resources/assets/less/AdminLTE.less
#	resources/assets/less/overrides.less
#	resources/assets/less/skins/_all-skins.less
#	resources/assets/less/skins/skin-black.less
#	resources/assets/less/skins/skin-blue.less
#	resources/assets/less/skins/skin-green.less
#	resources/assets/less/skins/skin-purple.less
#	resources/assets/less/skins/skin-red.less
#	resources/assets/less/skins/skin-yellow.less
#	resources/assets/less/variables.less
#	resources/js/components/importer/importer-file.vue
#	resources/lang/en/auth/message.php
#	resources/lang/en/passwords.php
#	resources/lang/es-CO/general.php
#	resources/lang/es-ES/general.php
#	resources/lang/es-VE/general.php
#	resources/less/skins/skin-black-dark.less
#	resources/less/skins/skin-blue-dark.less
#	resources/less/skins/skin-contrast.less
#	resources/less/skins/skin-green-dark.less
#	resources/less/skins/skin-orange-dark.less
#	resources/less/skins/skin-orange.less
#	resources/less/skins/skin-purple-dark.less
#	resources/less/skins/skin-red-dark.less
#	resources/less/skins/skin-yellow-dark.less
#	resources/views/accessories/checkin.blade.php
#	resources/views/accessories/checkout.blade.php
#	resources/views/accessories/edit.blade.php
#	resources/views/account/profile.blade.php
#	resources/views/account/view-assets.blade.php
#	resources/views/asset_maintenances/edit.blade.php
#	resources/views/auth/passwords/email.blade.php
#	resources/views/auth/passwords/reset.blade.php
#	resources/views/categories/edit.blade.php
#	resources/views/companies/edit.blade.php
#	resources/views/components/checkin.blade.php
#	resources/views/components/checkout.blade.php
#	resources/views/components/edit.blade.php
#	resources/views/consumables/checkout.blade.php
#	resources/views/consumables/edit.blade.php
#	resources/views/custom_fields/fields/edit.blade.php
#	resources/views/custom_fields/fieldsets/edit.blade.php
#	resources/views/dashboard.blade.php
#	resources/views/departments/edit.blade.php
#	resources/views/groups/edit.blade.php
#	resources/views/hardware/audit.blade.php
#	resources/views/hardware/bulk-checkout.blade.php
#	resources/views/hardware/bulk.blade.php
#	resources/views/hardware/checkin.blade.php
#	resources/views/hardware/checkout.blade.php
#	resources/views/hardware/edit.blade.php
#	resources/views/hardware/index.blade.php
#	resources/views/hardware/quickscan.blade.php
#	resources/views/hardware/view.blade.php
#	resources/views/importer/import.blade.php
#	resources/views/layouts/basic.blade.php
#	resources/views/layouts/default.blade.php
#	resources/views/layouts/edit-form.blade.php
#	resources/views/licenses/checkin.blade.php
#	resources/views/licenses/checkout.blade.php
#	resources/views/licenses/edit.blade.php
#	resources/views/locations/edit.blade.php
#	resources/views/manufacturers/edit.blade.php
#	resources/views/modals/upload-file.blade.php
#	resources/views/models/bulk-edit.blade.php
#	resources/views/models/custom_fields_form.blade.php
#	resources/views/models/edit.blade.php
#	resources/views/partials/bootstrap-table.blade.php
#	resources/views/partials/forms/edit/address.blade.php
#	resources/views/partials/forms/edit/asset-select.blade.php
#	resources/views/partials/forms/edit/category-select.blade.php
#	resources/views/partials/forms/edit/category.blade.php
#	resources/views/partials/forms/edit/company-select.blade.php
#	resources/views/partials/forms/edit/company.blade.php
#	resources/views/partials/forms/edit/department-select.blade.php
#	resources/views/partials/forms/edit/depreciation.blade.php
#	resources/views/partials/forms/edit/email.blade.php
#	resources/views/partials/forms/edit/image-upload.blade.php
#	resources/views/partials/forms/edit/item_number.blade.php
#	resources/views/partials/forms/edit/location-profile-select.blade.php
#	resources/views/partials/forms/edit/location-select.blade.php
#	resources/views/partials/forms/edit/location.blade.php
#	resources/views/partials/forms/edit/maintenance_type.blade.php
#	resources/views/partials/forms/edit/manufacturer-select.blade.php
#	resources/views/partials/forms/edit/manufacturer.blade.php
#	resources/views/partials/forms/edit/minimum_quantity.blade.php
#	resources/views/partials/forms/edit/model-select.blade.php
#	resources/views/partials/forms/edit/model_number.blade.php
#	resources/views/partials/forms/edit/name.blade.php
#	resources/views/partials/forms/edit/notes.blade.php
#	resources/views/partials/forms/edit/order_number.blade.php
#	resources/views/partials/forms/edit/phone.blade.php
#	resources/views/partials/forms/edit/purchase_cost.blade.php
#	resources/views/partials/forms/edit/purchase_date.blade.php
#	resources/views/partials/forms/edit/quantity.blade.php
#	resources/views/partials/forms/edit/serial.blade.php
#	resources/views/partials/forms/edit/status.blade.php
#	resources/views/partials/forms/edit/submit.blade.php
#	resources/views/partials/forms/edit/supplier-select.blade.php
#	resources/views/partials/forms/edit/supplier.blade.php
#	resources/views/partials/forms/edit/user-select.blade.php
#	resources/views/reports/custom.blade.php
#	resources/views/settings/alerts.blade.php
#	resources/views/settings/asset_tags.blade.php
#	resources/views/settings/barcodes.blade.php
#	resources/views/settings/branding.blade.php
#	resources/views/settings/general.blade.php
#	resources/views/settings/labels.blade.php
#	resources/views/settings/ldap.blade.php
#	resources/views/settings/localization.blade.php
#	resources/views/settings/security.blade.php
#	resources/views/setup/user.blade.php
#	resources/views/suppliers/edit.blade.php
#	resources/views/users/bulk-edit.blade.php
#	resources/views/users/edit.blade.php
#	resources/views/users/ldap.blade.php
#	resources/views/users/print.blade.php
#	resources/views/users/view.blade.php
#	routes/api.php
#	routes/web/hardware.php
#	webpack.mix.js
2020-04-20 23:20:34 -07:00

559 lines
15 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) {
$locales = array(
''=> " ",
'en'=> "English, US",
'en-GB'=> "English, UK",
'af'=> "Afrikaans",
'ar'=> "Arabic",
'bg'=> "Bulgarian",
'zh-CN'=> "Chinese Simplified",
'zh-TW'=> "Chinese Traditional",
'hr'=> "Croatian",
'cs'=> "Czech",
'da'=> "Danish",
'nl'=> "Dutch",
'en-ID'=> "English, Indonesia",
'et'=> "Estonian",
'fil'=> "Filipino",
'fi'=> "Finnish",
'fr'=> "French",
'de'=> "German",
'el'=> "Greek",
'he'=> "Hebrew",
'hu'=> "Hungarian",
'is' => 'Icelandic',
'id'=> "Indonesian",
'ga-IE'=> "Irish",
'it'=> "Italian",
'ja'=> "Japanese",
'ko'=> "Korean",
'lv'=>'Latvian',
'lt'=> "Lithuanian",
'mk'=> "Macedonian",
'ms'=> "Malay",
'mi'=> "Maori",
'mn'=> "Mongolian",
'no'=> "Norwegian",
'fa'=> "Persian",
'pl'=> "Polish",
'pt-PT'=> "Portuguese",
'pt-BR'=> "Portuguese, Brazilian",
'ro'=> "Romanian",
'ru'=> "Russian",
'sr-CS' => 'Serbian (Latin)',
'sl'=> "Slovenian",
'es-ES'=> "Spanish",
'es-CO'=> "Spanish, Colombia",
'es-MX'=> "Spanish, Mexico",
'es-VE'=> "Spanish, Venezuela",
'sv-SE'=> "Swedish",
'tl'=> "Tagalog",
'ta'=> "Tamil",
'th'=> "Thai",
'tr'=> "Turkish",
'uk'=> "Ukranian",
'vi'=> "Vietnamese",
'zu'=> "Zulu",
);
$idclause='';
if($id) {
$idclause=" id='$id'";
}
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:350px"'.$idclause.' aria-label="'.$name.'">';
foreach ($locales as $abbr => $locale) {
$select .= '<option value="'.$abbr.'"'.($selected == $abbr ? ' selected="selected"' : '').'>'.$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) {
$countries = array(
''=>"Select a Country",
'AC'=>'Ascension Island',
'AD'=>'Andorra',
'AE'=>'United Arab Emirates',
'AF'=>'Afghanistan',
'AG'=>'Antigua And Barbuda',
'AI'=>'Anguilla',
'AL'=>'Albania',
'AM'=>'Armenia',
'AN'=>'Netherlands Antilles',
'AO'=>'Angola',
'AQ'=>'Antarctica',
'AR'=>'Argentina',
'AS'=>'American Samoa',
'AT'=>'Austria',
'AU'=>'Australia',
'AW'=>'Aruba',
'AX'=>'Ã…land',
'AZ'=>'Azerbaijan',
'BA'=>'Bosnia And Herzegovina',
'BB'=>'Barbados',
'BE'=>'Belgium',
'BD'=>'Bangladesh',
'BF'=>'Burkina Faso',
'BG'=>'Bulgaria',
'BH'=>'Bahrain',
'BI'=>'Burundi',
'BJ'=>'Benin',
'BM'=>'Bermuda',
'BN'=>'Brunei Darussalam',
'BO'=>'Bolivia',
'BR'=>'Brazil',
'BS'=>'Bahamas',
'BT'=>'Bhutan',
'BV'=>'Bouvet Island',
'BW'=>'Botswana',
'BY'=>'Belarus',
'BZ'=>'Belize',
'CA'=>'Canada',
'CC'=>'Cocos (Keeling) Islands',
'CD'=>'Congo (Democratic Republic)',
'CF'=>'Central African Republic',
'CG'=>'Congo (Republic)',
'CH'=>'Switzerland',
'CI'=>'Côte d\'Ivoire',
'CK'=>'Cook Islands',
'CL'=>'Chile',
'CM'=>'Cameroon',
'CN'=>'People\'s Republic of China',
'CO'=>'Colombia',
'CR'=>'Costa Rica',
'CU'=>'Cuba',
'CV'=>'Cape Verde',
'CX'=>'Christmas Island',
'CY'=>'Cyprus',
'CZ'=>'Czech Republic',
'DE'=>'Germany',
'DJ'=>'Djibouti',
'DK'=>'Denmark',
'DM'=>'Dominica',
'DO'=>'Dominican Republic',
'DZ'=>'Algeria',
'EC'=>'Ecuador',
'EE'=>'Estonia',
'EG'=>'Egypt',
'ER'=>'Eritrea',
'ES'=>'Spain',
'ET'=>'Ethiopia',
'EU'=>'European Union',
'FI'=>'Finland',
'FJ'=>'Fiji',
'FK'=>'Falkland Islands (Malvinas)',
'FM'=>'Micronesia, Federated States Of',
'FO'=>'Faroe Islands',
'FR'=>'France',
'GA'=>'Gabon',
'GD'=>'Grenada',
'GE'=>'Georgia',
'GF'=>'French Guiana',
'GG'=>'Guernsey',
'GH'=>'Ghana',
'GI'=>'Gibraltar',
'GL'=>'Greenland',
'GM'=>'Gambia',
'GN'=>'Guinea',
'GP'=>'Guadeloupe',
'GQ'=>'Equatorial Guinea',
'GR'=>'Greece',
'GS'=>'South Georgia And The South Sandwich Islands',
'GT'=>'Guatemala',
'GU'=>'Guam',
'GW'=>'Guinea-Bissau',
'GY'=>'Guyana',
'HK'=>'Hong Kong',
'HM'=>'Heard And Mc Donald Islands',
'HN'=>'Honduras',
'HR'=>'Croatia (local name: Hrvatska)',
'HT'=>'Haiti',
'HU'=>'Hungary',
'ID'=>'Indonesia',
'IE'=>'Ireland',
'IL'=>'Israel',
'IM'=>'Isle of Man',
'IN'=>'India',
'IO'=>'British Indian Ocean Territory',
'IQ'=>'Iraq',
'IR'=>'Iran, Islamic Republic Of',
'IS'=>'Iceland',
'IT'=>'Italy',
'JE'=>'Jersey',
'JM'=>'Jamaica',
'JO'=>'Jordan',
'JP'=>'Japan',
'KE'=>'Kenya',
'KG'=>'Kyrgyzstan',
'KH'=>'Cambodia',
'KI'=>'Kiribati',
'KM'=>'Comoros',
'KN'=>'Saint Kitts And Nevis',
'KR'=>'Korea, Republic Of',
'KW'=>'Kuwait',
'KY'=>'Cayman Islands',
'KZ'=>'Kazakhstan',
'LA'=>'Lao People\'s Democratic Republic',
'LB'=>'Lebanon',
'LC'=>'Saint Lucia',
'LI'=>'Liechtenstein',
'LK'=>'Sri Lanka',
'LR'=>'Liberia',
'LS'=>'Lesotho',
'LT'=>'Lithuania',
'LU'=>'Luxembourg',
'LV'=>'Latvia',
'LY'=>'Libyan Arab Jamahiriya',
'MA'=>'Morocco',
'MC'=>'Monaco',
'MD'=>'Moldova, Republic Of',
'ME'=>'Montenegro',
'MG'=>'Madagascar',
'MH'=>'Marshall Islands',
'MK'=>'Macedonia, The Former Yugoslav Republic Of',
'ML'=>'Mali',
'MM'=>'Myanmar',
'MN'=>'Mongolia',
'MO'=>'Macau',
'MP'=>'Northern Mariana Islands',
'MQ'=>'Martinique',
'MR'=>'Mauritania',
'MS'=>'Montserrat',
'MT'=>'Malta',
'MU'=>'Mauritius',
'MV'=>'Maldives',
'MW'=>'Malawi',
'MX'=>'Mexico',
'MY'=>'Malaysia',
'MZ'=>'Mozambique',
'NA'=>'Namibia',
'NC'=>'New Caledonia',
'NE'=>'Niger',
'NF'=>'Norfolk Island',
'NG'=>'Nigeria',
'NI'=>'Nicaragua',
'NL'=>'Netherlands',
'NO'=>'Norway',
'NP'=>'Nepal',
'NR'=>'Nauru',
'NU'=>'Niue',
'NZ'=>'New Zealand',
'OM'=>'Oman',
'PA'=>'Panama',
'PE'=>'Peru',
'PF'=>'French Polynesia',
'PG'=>'Papua New Guinea',
'PH'=>'Philippines, Republic of the',
'PK'=>'Pakistan',
'PL'=>'Poland',
'PM'=>'St. Pierre And Miquelon',
'PN'=>'Pitcairn',
'PR'=>'Puerto Rico',
'PS'=>'Palestine',
'PT'=>'Portugal',
'PW'=>'Palau',
'PY'=>'Paraguay',
'QA'=>'Qatar',
'RE'=>'Reunion',
'RO'=>'Romania',
'RS'=>'Serbia',
'RU'=>'Russian Federation',
'RW'=>'Rwanda',
'SA'=>'Saudi Arabia',
'UK'=>'Scotland',
'SB'=>'Solomon Islands',
'SC'=>'Seychelles',
'SD'=>'Sudan',
'SE'=>'Sweden',
'SG'=>'Singapore',
'SH'=>'St. Helena',
'SI'=>'Slovenia',
'SJ'=>'Svalbard And Jan Mayen Islands',
'SK'=>'Slovakia (Slovak Republic)',
'SL'=>'Sierra Leone',
'SM'=>'San Marino',
'SN'=>'Senegal',
'SO'=>'Somalia',
'SR'=>'Suriname',
'ST'=>'Sao Tome And Principe',
'SU'=>'Soviet Union',
'SV'=>'El Salvador',
'SY'=>'Syrian Arab Republic',
'SZ'=>'Swaziland',
'TC'=>'Turks And Caicos Islands',
'TD'=>'Chad',
'TF'=>'French Southern Territories',
'TG'=>'Togo',
'TH'=>'Thailand',
'TJ'=>'Tajikistan',
'TK'=>'Tokelau',
'TI'=>'East Timor',
'TM'=>'Turkmenistan',
'TN'=>'Tunisia',
'TO'=>'Tonga',
'TP'=>'East Timor (old code)',
'TR'=>'Turkey',
'TT'=>'Trinidad And Tobago',
'TV'=>'Tuvalu',
'TW'=>'Taiwan',
'TZ'=>'Tanzania, United Republic Of',
'UA'=>'Ukraine',
'UG'=>'Uganda',
'UK'=>'United Kingdom',
'US'=>'United States',
'UM'=>'United States Minor Outlying Islands',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VA'=>'Vatican City State (Holy See)',
'VC'=>'Saint Vincent And The Grenadines',
'VE'=>'Venezuela',
'VG'=>'Virgin Islands (British)',
'VI'=>'Virgin Islands (U.S.)',
'VN'=>'Viet Nam',
'VU'=>'Vanuatu',
'WF'=>'Wallis And Futuna Islands',
'WS'=>'Samoa',
'YE'=>'Yemen',
'YT'=>'Mayotte',
'ZA'=>'South Africa',
'ZM'=>'Zambia',
'ZW'=>'Zimbabwe'
);
$idclause='';
if($id) {
$idclause=" id='$id'";
}
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:350px"'.$idclause.' aria-label="'.$name.'">';
foreach ($countries as $abbr => $country) {
$select .= '<option value="'.strtoupper($abbr).'"'.(strtoupper($selected)== strtoupper($abbr) ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$country.'</option> ';
}
$select .= '</select>';
return $select;
});
Form::macro('date_display_format', function ($name = "date_display_format", $selected = null, $class = null) {
$formats = [
'Y-m-d',
'Y-m-d',
'D M d, Y',
'M j, Y',
'd M, Y',
'm/d/Y',
'n/d/y',
'd/m/Y',
'm/j/Y',
'd.m.Y',
'Y.m.d.',
];
foreach ($formats as $format) {
$date_display_formats[$format] = Carbon::parse(date('Y').'-'.date('m').'-25')->format($format);
}
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:250px" 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',
];
foreach ($formats as $format) {
$time_display_formats[$format] = Carbon::now()->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;
});
/**
* 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 = array(
'C128',
'C39',
'PDF417',
'EAN5',
);
$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 = array(
'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 = array(
'firstname.lastname' => trans('general.firstname_lastname_format'),
'firstname_lastname' => trans('general.firstname_lastname_underscore_format'),
'filastname' => trans('general.filastname_format'),
'firstintial.lastname' => trans('general.firstintial_dot_lastname_format'),
'firstname' => trans('general.first_name_format'),
'lastnamefirstinitial' => trans('general.lastnamefirstinitial_format'),
);
$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 = array(
'' => 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 = array(
'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 = array(
'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;
});