<?php
if (PhonalisaLicenseManager::provisioningProfileMax() !== 0) {
    echo $form->dropDownListRow(
            $model, 'provisioningProfile', $this->getProvisioningProfileData(), array(
        'data-translation-target' => 'USERGROUP_MODEL_PROVISIONING_PROFILE_TRANSLATION')
    );
}

if (PhonalisaLicenseManager::provisioningKeyProfileMax() !== 0) {
    echo $form->dropDownListRow(
            $model, 'keyProfile', $this->getKeyProfileData(), array(
        'data-translation-target' => 'USERGROUP_MODEL_KEY_PROFILE_TRANSLATION')
    );
}

if (PhonalisaLicenseManager::phonesettingsSpeedDialMax() !== 0) {
    echo $form->dropDownListRow(
            $model, 'speedDialList', $this->getSpeedDialListData(), array(
        'data-translation-target' => 'GROUPS_MODEL_SPEED_DIAL_LIST_TRANSLATION'
    ));
}

if (PhonalisaLicenseManager::routingBlacklistEnabled()) {
    echo $form->dropDownListRow(
            $model, 'inboundBlacklistId', $this->getBlacklistData(), array(
        'data-translation-target' => 'USERGROUP_MODEL_INBOUND_BLACKLIST_ID_TRANSLATION')
    );
    echo $form->dropDownListRow(
            $model, 'outboundBlacklistId', $this->getBlacklistData(), array(
        'data-translation-target' => 'USERGROUP_MODEL_OUTBOUND_BLACKLIST_ID_TRANSLATION')
    );
}

if (PhonalisaLicenseManager::routingScriptExtensionMax() !== 0) {
    echo $form->dropDownListRow(
            $model, 'scriptExtensionUser', ScriptExtension::model()->listData, array(
        'class' => 'span3',
        'data-translation-id' => 'USER_MODEL_SCRIPT_EXTENSION_USER',
            )
    );

    echo $form->dropDownListRow(
            $model, 'scriptExtensionGroup', ScriptExtension::model()->listData, array(
        'class' => 'span3',
        'data-translation-id' => 'USER_MODEL_SCRIPT_EXTENSION_GROUP',
            )
    );
}

if (PhonalisaLicenseManager::faxGUIEnabled()) {

    echo $form->dropDownListRow($model, 'faxSendAllowed', $model->getFaxSendPermission(), array(
        'class' => 'span3',
        'data-translation-target' => 'FAX_SENDING_ALLOWED_TRANSLATION',
    ));

    echo $form->textFieldRow($model, 'fax_header_text', array(
        'class' => 'span3',
        'data-translation-id' => 'GROUPS_MODEL_FAX_HEADER_TEXT',
    ));

    echo $form->textFieldRow($model, 'fax_header_number', array(
        'class' => 'span3',
        'data-translation-id' => 'GROUPS_MODEL_FAX_HEADER_NUMBER',
    ));
}
echo $form->textFieldRow($model, 'droptarget', array(
    'class' => 'span3',
    'data-translation-id' => 'GROUPS_MODEL_DROP_TARGET',
));

echo $form->textFieldRow($model, 'maxRingTime', array(
    'class' => 'span1',
    'data-translation-id' => 'GROUPS_MODEL_MAX_RING_TIME',
    'onChange' => 'setDefaultValue();',
    'append' => __('QUEUE_MODEL_WAITING_TIME_SECONDS'),
));

if (ModuleManager::moduleAvailable("adminBilling") && PhonalisaLicenseManager::adminBillingEnabled()) {
    echo $form->checkBoxRow($model, 'accountingEnabled', array(
        'data-translation-id' => 'USERGROUPS_MODEL_ACCOUNTING_ENABLED'
    ));
}
?>
<script>
    setDefaultValue();
    function setDefaultValue() {
        var maxRingTime = $('#Groups_maxRingTime').val();
        if (maxRingTime === '') {
            $('#Groups_maxRingTime').val('<?php echo Groups::DEFAULT_MAX_RING_TIME; ?>');
        }
    }
</script>