<commit_before><?php

namespace UMRA\Bundle\MemberBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;

class MemberAdmin extends Admin
{
    protected $baseRouteName = 'admin_umra_member';
    protected $baseRoutePattern = 'member';

    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('Personal Information')
                ->add('household')
                ->add('lastname', 'text', array(
                        'label' => 'Last Name'
                    ))
                ->add('firstname', 'text', array(
                        'label' => 'First Name'
                    ))
                ->add('nickname', 'text', array(
                        'label' => 'Nickname'
                    ))
                ->add('fullname', 'text', array(
                        'label' => 'Full Name'
                    ))
                ->add('nametagname', 'text', array(
                        'label' => 'Nametag Name'
                    ))
                ->add('deceasedate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'Deceased Date',
                        'required' => false
                    ))
                ->add('weburl', 'url', array(
                        'label' => 'Personal Website',
                        'required' => false,
                        'attr' => array('placeholder' => 'e.g. http://umn.edu/~test001/')
                    ))
            ->end()
            ->with('University Information')
                ->add('utopunit', 'text', array(
                        'label' => 'University Unit',
                        'required' => false
                    ))
                ->add('udeptequiv', 'text', array(
                        'label' => 'University Department',
                        'required' => false
                    ))
                ->add('uempltype', 'choice', array(
                        'choices' => array(
                            'faculty' => 'Faculty',
                            'acad_prof' => 'Academic Professional',
                            'acad_adm' => 'Academic Administrator',
                            'civ_srv' => 'Civil Service',
                            'afscme_cler' => 'AFSCME Clerical',
                            'afscme_tech' => 'AFSCME Technical',
                            'teamster' => 'Teamster'
                        ),
                        'label' => 'Employment Type',
                        'required' => false
                    ))
                ->add('utitle', 'text', array(
                        'label' => 'Title',
                        'required' => false
                    ))
                ->add('ustartdate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'University Start Date',
                        'required' => false
                    ))
                ->add('uretiredate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'University Retire Date',
                        'required' => false
                    ))
            ->end()
            ->with('UMRA Information')
                ->add('membersince', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'UMRA Member Since',
                        'required' => false
                    ))
                ->add('activenow', 'checkbox', array(
                        'label' => 'Active',
                        'required' => false
                    ))
                ->add('newsPref', 'choice', array(
                        'choices' => array(
                            'postal' => 'Postal Mail',
                            'email' => 'Email',
                            'both' => 'Both'
                        ),
                        'label' => 'Newsletter Preference',
                        'expanded' => false,
                        'required' => false
                    ))
            ->end()
            ->with('Emails')
                ->add('emailCanonical', 'email', array('label' => 'Login Email Address'))
                ->add('emails')
            ->end()
        ;
    }

    protected function configureShowFields(ShowMapper $showMapper)
    {
        $showMapper
            ->with('Personal Information')
                ->add('household')
                ->add('lastname',  null, array(
                        'label' => 'Last Name'
                    ))
                ->add('firstname', null, array(
                        'label' => 'First Name'
                    ))
                ->add('nickname', null, array(
                        'label' => 'Nickname'
                    ))
                ->add('fullname', null, array(
                        'label' => '<NAME>'
                    ))
                ->add('nametagname', null, array('label' => 'Nametag Name'))
                ->add('deceasedate', null, array('label' => 'Deceased Date'))
                ->add('weburl', null, array('label' => 'Homepage URL'))
            ->end()
            ->with('University Information')
                ->add('utopunit', null, array('label' => 'University Unit'))
                ->add('udeptequiv', null, array('label' => 'University Department'))
                ->add('uempltype', null, array('label' => 'Employment Type'))
                ->add('utitle', null, array('label' => 'Job Title'))
                ->add('ustartdate', null, array('label' => 'University Start Date'))
                ->add('uretiredate', null, array('label' => 'University Retire Date'))
            ->end()
            ->with('UMRA Information')
                ->add('membersince', null, array('label' => 'UMRA Member Since'))
                ->add('activenow', null, array('label' => 'Active'))
                ->add('newsPref', null, array('label' => 'Newsletter Preference'))
            ->end()
            ->with('Emails')
                ->add('emailCanonical', 'email', array('label' => 'Login Email Address'))
                ->add('emails')
            ->end()
            ->with('Transactions')
                ->add('transactions')
            ->end()
        ;
    }

    // Fields to be shown on filter forms
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('lastname')
            ->add('firstname')
            ->add('utopunit')
            ->add('udeptequiv')
            ->add('uempltype')
            ->add('membersince')
            ->add('activenow')
        ;
    }

    // Fields to be shown on lists
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('fullname', null, array('label' => '<NAME>'))
            ->add('membersince', null, array('label' => 'Member Since'))<commit_msg>Add friendlier labels to MemberAdmin<commit_after><?php

namespace UMRA\Bundle\MemberBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Show\ShowMapper;

class MemberAdmin extends Admin
{
    protected $baseRouteName = 'admin_umra_member';
    protected $baseRoutePattern = 'member';

    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->with('Personal Information')
                ->add('household')
                ->add('lastname', 'text', array(
                        'label' => 'Last Name'
                    ))
                ->add('firstname', 'text', array(
                        'label' => 'First Name'
                    ))
                ->add('nickname', 'text', array(
                        'label' => 'Nickname'
                    ))
                ->add('fullname', 'text', array(
                        'label' => 'Full Name'
                    ))
                ->add('nametagname', 'text', array(
                        'label' => 'Nametag Name'
                    ))
                ->add('deceasedate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'Deceased Date',
                        'required' => false
                    ))
                ->add('weburl', 'url', array(
                        'label' => 'Personal Website',
                        'required' => false,
                        'attr' => array('placeholder' => 'e.g. http://umn.edu/~test001/')
                    ))
            ->end()
            ->with('University Information')
                ->add('utopunit', 'text', array(
                        'label' => 'University Unit',
                        'required' => false
                    ))
                ->add('udeptequiv', 'text', array(
                        'label' => 'University Department',
                        'required' => false
                    ))
                ->add('uempltype', 'choice', array(
                        'choices' => array(
                            'faculty' => 'Faculty',
                            'acad_prof' => 'Academic Professional',
                            'acad_adm' => 'Academic Administrator',
                            'civ_srv' => 'Civil Service',
                            'afscme_cler' => 'AFSCME Clerical',
                            'afscme_tech' => 'AFSCME Technical',
                            'teamster' => 'Teamster'
                        ),
                        'label' => 'Employment Type',
                        'required' => false
                    ))
                ->add('utitle', 'text', array(
                        'label' => 'Title',
                        'required' => false
                    ))
                ->add('ustartdate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'University Start Date',
                        'required' => false
                    ))
                ->add('uretiredate', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'University Retire Date',
                        'required' => false
                    ))
            ->end()
            ->with('UMRA Information')
                ->add('membersince', 'date', array(
                        'years' => range(1910, date('Y')),
                        'label' => 'UMRA Member Since',
                        'required' => false
                    ))
                ->add('activenow', 'checkbox', array(
                        'label' => 'Active',
                        'required' => false
                    ))
                ->add('newsPref', 'choice', array(
                        'choices' => array(
                            'postal' => 'Postal Mail',
                            'email' => 'Email',
                            'both' => 'Both'
                        ),
                        'label' => 'Newsletter Preference',
                        'expanded' => false,
                        'required' => false
                    ))
            ->end()
            ->with('Emails')
                ->add('emailCanonical', 'email', array('label' => 'Login Email Address'))
                ->add('emails')
            ->end()
        ;
    }

    protected function configureShowFields(ShowMapper $showMapper)
    {
        $showMapper
            ->with('Personal Information')
                ->add('household')
                ->add('lastname',  null, array(
                        'label' => 'Last Name'
                    ))
                ->add('firstname', null, array(
                        'label' => 'First Name'
                    ))
                ->add('nickname', null, array(
                        'label' => 'Nickname'
                    ))
                ->add('fullname', null, array(
                        'label' => 'Full Name'
                    ))
                ->add('nametagname', null, array('label' => 'Nametag Name'))
                ->add('deceasedate', null, array('label' => 'Deceased Date'))
                ->add('weburl', null, array('label' => 'Homepage URL'))
            ->end()
            ->with('University Information')
                ->add('utopunit', null, array('label' => 'University Unit'))
                ->add('udeptequiv', null, array('label' => 'University Department'))
                ->add('uempltype', null, array('label' => 'Employment Type'))
                ->add('utitle', null, array('label' => 'Job Title'))
                ->add('ustartdate', null, array('label' => 'University Start Date'))
                ->add('uretiredate', null, array('label' => 'University Retire Date'))
            ->end()
            ->with('UMRA Information')
                ->add('membersince', null, array('label' => 'UMRA Member Since'))
                ->add('activenow', null, array('label' => 'Active'))
                ->add('newsPref', null, array('label' => 'Newsletter Preference'))
            ->end()
            ->with('Emails')
                ->add('emailCanonical', 'email', array('label' => 'Login Email Address'))
                ->add('emails')
            ->end()
            ->with('Transactions')
                ->add('transactions')
            ->end()
        ;
    }

    // Fields to be shown on filter forms
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('lastname', null, array('label' => '<NAME>'))
            ->add('firstname', null, array('label' => '<NAME>'))
            ->add('utopunit', null, array('label' => 'University Unit'))
            ->add('udeptequiv', null, array('label' => 'University Department'))
            ->add('uempltype', null, array('label' => 'Employment Type'))
            ->add('membersince', null, array('label' => 'Member Since'))
            ->add('activenow', null, array('label' => 'Active'))
            ->add('locked')
        ;
    }

    // Fields to be shown on lists
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('fullname', null, array('label' => '<NAME>'))
            ->add('membersince', null, array('label' => 'Member Since'))
{'fraction_non_alphanumeric': 0.1492112923972649, 'fraction_numerical': 0.0025726084896080157, 'mean_word_length': 1.2133652981720109, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 280, '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': '5136175', 'n_tokens_mistral': 3801, 'n_tokens_neox': 3507, 'n_words': 770}