'Render the check-in page
@param r: the S3Request
@param attr: controller parameters'

def check_in_form(self, r, **attr):

    T = current.T
    response = current.response
    settings = current.deployment_settings
    output = {'title': T('Check-in')}
    request_vars = r.get_vars
    label = request_vars.get('label')
    person = None
    pe_label = None
    if (label is not None):
        person = self.get_person(label)
        if (person is None):
            response.error = T('No    person    found    with    this    ID    number')
    person_data = None
    if person:
        status = self.status(r, person)
        if (not status.get('valid')):
            person = None
            response.error = status.get('error', T('Person    not    allowed    to    check-in/out    at    this    site'))
        else:
            pe_label = person.pe_label
            person_data = self.ajax_data(person, status)
    from s3 import S3StringWidget
    formfields = [Field('label', label=T('ID'), requires=IS_NOT_EMPTY(error_message=T('Enter    or    scan    an    ID')), widget=self.label_input), Field('person', label='', writable=False, default=''), Field('status', label='', writable=False, default=''), Field('info', label='', writable=False, default='')]
    data = {'id': '', 'label': pe_label, 'person': '', 'status': '', 'info': ''}
    hidden = {'data': json.dumps(person_data)}
    check_btn = INPUT(_class='tiny    secondary    button    check-btn', _name='check', _type='submit', _value=T('Check    ID'))
    check_in_btn = INPUT(_class='tiny    primary    button    check-in-btn', _name='check_in', _type='submit', _value=T('Check-in'))
    check_out_btn = INPUT(_class='tiny    primary    button    check-out-btn', _name='check_out', _type='submit', _value=T('Check-out'))
    buttons = [check_btn, check_in_btn, check_out_btn]
    buttons.append(A(T('Cancel'), _class='cancel-action    action-lnk', _href=r.url(vars={})))
    formstyle = settings.get_ui_formstyle()
    widget_id = 'check-in-form'
    table_name = 'site_check_in'
    form = SQLFORM.factory(record=(data if person else None), showid=False, formstyle=formstyle, table_name=table_name, buttons=buttons, hidden=hidden, _id=widget_id, *formfields)
    output['form'] = form
    options = {'tableName': table_name, 'ajaxURL': r.url(None, representation='json'), 'noPictureAvailable': s3_str(T('No    picture    available')), 'statusCheckedIn': s3_str(T('checked-in')), 'statusCheckedOut': s3_str(T('checked-out')), 'statusNone': s3_str(current.messages['NONE']), 'statusLabel': s3_str(T('Status'))}
    self.inject_js(widget_id, options)
    response.view = 'org/site_check_in.html'
    return output
