<commit_before><?php

namespace App\Forms\Admin;

use App\Base\Forms\AdminForm;
use App\Role;

class UsersForm extends AdminForm
{
    public function buildForm()
    {

        $roles = Role::all()->pluck('name', 'id')->toArray();

        $this
            ->add('name_first', 'text', [
                'label' => "First Name"
            ])
            ->add('name_last', 'text', [
                'label' => "Last Name"
            ])

            ->add("affiliation_id", "select", [
                "choices" => $this->parseAffiliationsIntoSelectArray(),
                "label" => "Affiliation"
            ])

            ->add('rank', 'text', [
                'label' => "Rank / Position"
            ])

            ->add('role', 'choice', [
                'choices' => $roles,
                'multiple' => false
            ])

            ->add('nomination_limit', 'text', [
                'label' => "Nomination Limit (Yearly)"
            ])

            ->add('phone', 'text', [
                'label' => "Phone Number"
            ])

            ->add('email', 'email', [
                'label' => trans('admin.fields.user.email')
            ])
            ->add('password', 'password', [
                'label' => trans('admin.fields.user.password'),
                'value' => ''
            ])
            ->add('password_confirmation', 'password', [
                'label' => trans('admin.fields.user.password_confirmation')
            ]);

        parent::buildForm();
    }

    private function parseAffiliationsIntoSelectArray() {
        $a = array();
        $affiliations = \App\Affiliation::all(["id", "type", "name"]);
        foreach ($affiliations as $affiliation) {
            $a[$affiliation["id"]] = strtoupper($affiliation['type'] . " - " . ucwords($affiliation['name']));<commit_msg>User active flag<commit_after><?php

namespace App\Forms\Admin;

use App\Base\Forms\AdminForm;
use App\Role;

class UsersForm extends AdminForm
{
    public function buildForm()
    {

        $roles = Role::all()->pluck('name', 'id')->toArray();

        $this
            ->add('name_first', 'text', [
                'label' => "First Name"
            ])
            ->add('name_last', 'text', [
                'label' => "Last Name"
            ])

            ->add("affiliation_id", "select", [
                "choices" => $this->parseAffiliationsIntoSelectArray(),
                "label" => "Affiliation"
            ])

            ->add('rank', 'text', [
                'label' => "Rank / Position"
            ])

            ->add('role', 'choice', [
                'choices' => $roles,
                'multiple' => false
            ])

            ->add('nomination_limit', 'text', [
                'label' => "Nomination Limit (Yearly)"
            ])

            ->add('active', 'choice', [
                'choices' => ['N' => "No - Deactivated", 'Y' => "Yes - Active"],
                'multiple' => false,
                'label' => "Account Enabled"
            ])

            ->add('phone', 'text', [
                'label' => "Phone Number"
            ])

            ->add('email', 'email', [
                'label' => trans('admin.fields.user.email')
            ])
            ->add('password', 'password', [
                'label' => trans('admin.fields.user.password'),
                'value' => ''
            ])
            ->add('password_confirmation', 'password', [
                'label' => trans('admin.fields.user.password_confirmation')
            ]);

        parent::buildForm();
    }

    private function parseAffiliationsIntoSelectArray() {
        $a = array();
        $affiliations = \App\Affiliation::all(["id", "type", "name"]);
        foreach ($affiliations as $affiliation) {
            $a[$affiliation["id"]] = strtoupper($affiliation['type'] . " - " . ucwords($affiliation['name']));
{'fraction_non_alphanumeric': 0.17954662545079855, 'fraction_numerical': 0.0, 'mean_word_length': 1.568121693121693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3194724', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1060, 'n_words': 187}