<script type="text/javascript">
    [{include file="../assets/js/sync-profile.js"}]
</script>
<div id="jdisc-module-config">
    <h2 class="p5 gradient border-bottom">
        <span class="fr"><a href="[{$link_to_jdisc_import}]" target="_blank" title="[{isys type='lang' ident='LC__MODULE__JDISC__IMPORT'}]">[{isys type='lang' ident='LC__MODULE__JDISC__LINK_TO_IMPORT'}]</a></span>
        [{isys type='lang' ident='LC__MODULE__JDISC__PROFILES'}]
    </h2>
    <input type="hidden" name="C__MODULE__JDISC__COLUMN_SETTINGS" id="C__MODULE__JDISC__COLUMN_SETTINGS" value="[{$columnSettings|escape}]" />
    <input type="hidden" name="C__MODULE__JDISC__PROFILES__ID" value="[{$id}]" />
    <h3 class="p5 bg-neutral-200 border-top border-bottom">[{isys type='lang' ident='LC__MODULE__JDISC__PROFILES__COMMON_SETTINGS'}]</h3>
    <table class="contentTable" style="border-top: none;">
        <tr>
            <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__PROFILES__TITLE' ident='LC__MODULE__JDISC__PROFILES__TITLE'}]</td>
            <td class="value">[{isys type='f_text' name='C__MODULE__JDISC__PROFILES__TITLE'}]</td>
        </tr>
        <tr>
            <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__IMPORT__JDISC_SERVERS' ident='LC__MODULE__JDISC__IMPORT__JDISC_SERVERS'}]</td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__IMPORT__JDISC_SERVERS" p_bSort=false p_onChange="window.reload_profile(this.value);"}]
                <img src="[{$dir_images}]ajax-loading.gif" id="switch-server-loader" class="vam hide">
            </td>
        </tr>
        <tr>
            <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__PROFILES__DESCRIPTION' ident='LC__MODULE__JDISC__PROFILES__DESCRIPTION'}]</td>
            <td class="value">[{isys type='f_textarea' name='C__MODULE__JDISC__PROFILES__DESCRIPTION'}]</td>
        </tr>
    </table>

    <h3 class="p5 bg-neutral-200 border-top border-bottom mt10">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS'}]</h3>
    <div style="overflow-x:auto;">
        <table class="listing" style="border-top: none; min-width: 100%; width: auto">
            <thead>
            <tr>
                <th>[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_TYPE'}]</th>
                <th class="jdisc-os">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_OS'}]</th>
                <th class="object-title-transform">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__TITLE_TRANSFORM'}]</th>
                <th class="fqdn-addition">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__FQDN_ADDITION'}]</th>
                <th class="port-filter">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__PORT_FILTER'}]</th>
                <th>[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__OBJECT_TYPE'}]</th>
                <th>[{isys type='lang' ident='LC__MODULE__JDISC__PROFILES__OBJECT_MATCHING_PROFILE'}]</th>
                <th class="location">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__LOCATION'}]</th>
                <th>
                    <button type="button" class="btn" id="column-settings" title="[{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__COLUMN_SETTINGS'}]">
                        <img src="[{$dir_images}]axialis/basic/gear.svg" alt="[{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__COLUMN_SETTINGS'}]" />
                        <span class="pl5">
                        [{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__COLUMN_SETTINGS'}]
                        </span>
                    </button>
                </th>
            </tr>
            </thead>
            <tbody id="object_type_assignments">
            [{assign var="row_counter" value=0}]
            [{if $object_type_assignments|is_array && $object_type_assignments|count > 0}]
                [{foreach item="object_type_assignment" from=$object_type_assignments}]
                [{include file=$object_type_assignment_file object_type_assignment=$object_type_assignment}]
                [{assign var="row_counter" value=$row_counter+1}]
                [{/foreach}]
            [{else}]
                [{include file=$object_type_assignment_file}]
            [{/if}]
            </tbody>
        </table>
    </div>

    <dl class="m10">
        <dt style="font-weight: bold; margin-top: 1em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_TYPE'}]:</dt>
        <dd style="margin-left: 2em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_TYPE__DESCRIPTION'}]</dd>

        <dt style="font-weight: bold; margin-top: 1em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_OS'}]:</dt>
        <dd style="margin-left: 2em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__JDISC_OS__DESCRIPTION'}]</dd>

        <dt style="font-weight: bold; margin-top: 1em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__OBJECT_TYPE'}]:</dt>
        <dd style="margin-left: 2em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__OBJECT_TYPE__DESCRIPTION'}]</dd>

        <!-- TODOTODO Description of port filter -->

        <dt style="font-weight: bold; margin-top: 1em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_NAME_TRANSFORMATION'}]:</dt>
        <dd style="margin-left: 2em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_NAME_TRANSFORMATION__DESCRIPTION'}]</dd>

        <dt style="font-weight: bold; margin-top: 1em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__CUSTOMIZED'}]:</dt>
        <dd style="margin-left: 2em;">[{isys type='lang' ident='LC__MODULE__JDISC__OBJECT_TYPE_ASSIGNMENTS__CUSTOMIZED__DESCRIPTION'}]</dd>
    </dl>
    <h3 class="p5 bg-neutral-200 border-top border-bottom mt10">[{isys type='lang' ident='LC__MODULE__JDISC__SYNC_CONFIGURATION'}]</h3>
    <table class="contentTable" style="border-top: none;">
        <tr>
            <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__SYNC_CONFIG__JDISC_SERVERS' ident='LC__MODULE__JDISC__IMPORT__JDISC_SERVERS'}]</td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__JDISC_SERVERS" p_bDbFieldNN=1 p_bSort=false p_strClass="normal"}]
                <img src="[{$dir_images}]ajax-loading.gif" id="switch-server-loader" class="vam hide">
            </td>
        </tr>

        <tr id="jdisc_groups" style="[{if $jedi_version}]display:none;[{/if}]">
            <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__SYNC_CONFIG__GROUP' ident='LC__MODULE__JDISC__IMPORT__GROUP'}]</td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__GROUP" p_strClass="normal" p_bDbFieldNN="0" p_bSort=false}]
            </td>
        </tr>

        [{if count($filter_files) > 0}]
        <tr>
            <td class="key">
                [{isys type='f_label' name='C__MODULE__JDISC__SYNC_CONFIG__FILTER' ident='LC_UNIVERSAL__FILTERS'}]
            </td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__FILTER" p_strClass="normal" p_bSort=false}]
            </td>
        </tr>
        [{foreach from=$filter_files item='filter_file'}]
            [{include file=$filter_file}]
        [{/foreach}]
        [{/if}]
        <tr>
            <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__SYNC_CONFIG__MODE' ident='LC__MODULE__JDISC__IMPORT__MODE'}]</td>
            <td>
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__MODE" p_strClass="normal" p_bDbFieldNN=true}]
                <br class="cb" />
                <dl class="ml20 mt10">
                    <dt class="text-bold">[{isys type='lang' ident='LC__MODULE__JDISC__IMPORT__MODE'}]:</dt>
                    <dd style="margin-left: 2em;">[{isys type='lang' p_bHtmlEncode="0" ident='LC__MODULE__JDISC__IMPORT__MODE__DESCRIPTION'}]</dd>
                </dl>
            </td>
        </tr>
        [{if !$ip_unique_check}]
        <tr>
            <td class="key">[{isys type="f_label" name="C__MODULE__JDISC__SYNC_CONFIG__IP_CONFLICTS" ident="LC__MODULE__JDISC__IMPORT__OVERWRITE_IP_CONFLICTS"}]</td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__IP_CONFLICTS" p_strClass="normal" p_bDisabled=$ip_unique_check p_bDbFieldNN=true}]
            </td>
        </tr>
        [{/if}]
        <tr>
            <td class="key"><label for="C__MODULE__JDISC__SYNC_CONFIG__LOGGING">[{isys type="lang" ident="LC__MODULE__JDISC__IMPORT__LOGGING"}]</label></td>
            <td class="value">
                [{isys type="f_dialog" name="C__MODULE__JDISC__SYNC_CONFIG__LOGGING" p_bDbFieldNN=true}]
            </td>
        </tr>
        <tr>
            <td class="key"><label>[{isys type="lang" ident="LC__MODULE__JDISC__IMPORT__CREATE_SEARCH_INDEX"}]</label></td>
            <td class="value pl20"><input type="checkbox" [{if $confSearchIndex}]checked="checked"[{/if}] id="C__MODULE__JDISC__SYNC_CONFIG__SEARCH_INDEX" name="C__MODULE__JDISC__SYNC_CONFIG__SEARCH_INDEX"></td>
        </tr>
    </table>
    <h3 class="p5 bg-neutral-200 border-top border-bottom mt10">[{isys type='lang' ident='LC__MODULE__JDISC__ADDITIONAL_OPTIONS'}]</h3>
    <ul id="tabs" class="tabs bg-neutral-200">
        <li>
            <a href="#tab1">[{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__OPTIONS__GENERAL'}]</a>
        </li>
        <li>
            <a href="#tab2">[{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__OPTIONS__APP_OS'}]</a>
        </li>
        <li>
            <a href="#tab3">[{isys type='lang' ident='LC__JDISC__SYNC_PROFILES__OPTIONS__NETWORK'}]</a>
        </li>
    </ul>
    <div id="tab1" class="tab-content">
        <table class="contentTable">
            <tr>
                <td class="key">[{isys type='f_label' name="C__MODULE__JDISC__PROFILES__CATEGORIES" ident='LC__MODULE__JDISC__PROFILES__CATEGORIES'}]</td>
                <td class="value">[{isys type='f_dialog_list' name='C__MODULE__JDISC__PROFILES__CATEGORIES' p_strStyle="width:350px;"}]</td>
            </tr>
            <tr class="mac_rules [{if !$macCategoriesSelected}]hide[{/if}]">
                <td class="key vat">
                    [{isys type='f_label' name='C__MODULE__JDISC__MAC_FILTER_TYPE' ident='LC__MODULE__JDISC__MAC_FILTER'}]
                </td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__MAC_FILTER_TYPE"}]
                    <br class="cb" />
                    [{isys type="f_textarea" name="C__MODULE__JDISC__MAC_FILTER" p_strClass="mt5"}]
                </td>
            </tr>
            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__UPDATE_OBJTYPE' ident='LC__MODULE__JDISC__PROFILES__UPDATE_OBJTYPE'}]</td>
                <td class="pl20 value">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__UPDATE_OBJTYPE" name="C__MODULE__JDISC__UPDATE_OBJTYPE" [{if $update_objtype}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__UPDATE_OBJ_TITLE' ident='LC__MODULE__JDISC__PROFILES__UPDATE_OBJ_TITLE'}]</td>
                <td class="pl20 value">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__UPDATE_OBJ_TITLE" name="C__MODULE__JDISC__UPDATE_OBJ_TITLE" [{if $update_obj_title}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__ADOPT_LOCATION' ident='LC__MODULE__JDISC__ADOPT_LOCATION'}]</td>
                <td class="value">[{isys type='f_dialog' name='C__MODULE__JDISC__ADOPT_LOCATION' p_bDbFieldNN=1 p_arData=get_smarty_arr_YES_NO()}]</td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__USE_DEFAULT_TEMPLATES' ident='LC__MODULE__JDISC__USE_DEFAULT_TEMPLATES'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__USE_DEFAULT_TEMPLATES" name="C__MODULE__JDISC__USE_DEFAULT_TEMPLATES" [{if $use_default_templates}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CMDB_STATUS' ident='LC__MODULE__JDISC__PROFILES__CHANGE_CMDB_STATUS_OF_OBJECTS_TO'}]</td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__CMDB_STATUS" p_bDbFieldNN=1}]
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CMDB_STATUS__CREATED' ident='LC__MODULE__JDISC__PROFILES__CHANGE_CMDB_STATUS_OF_CREATED_OBJECTS_TO'}]</td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__CMDB_STATUS__CREATED" p_bDbFieldNN=1}]
                </td>
            </tr>
            [{if $is_jedi_version !== true}]
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__ADD_CUSTOM_ATTRIBUTES' ident='LC__MODULE__JDISC__ADD_CUSTOM_ATTRIBUTES'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__IMPORT_CUSTOM_ATTRIBUTES" name="C__MODULE__JDISC__IMPORT_CUSTOM_ATTRIBUTES" [{if $import_custom_attributes}]checked="checked"[{/if}] />
                </td>
            </tr>
            [{/if}]
        </table>
    </div>
    <div id="tab2" class="tab-content">
        <table class="contentTable" style="border-top: none;">
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__ONLY_CREATE_SOFTWARE_RELATIONS' ident='LC__MODULE__JDISC__SOFTWARE_IMPORT__IMPORT_ALL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__ONLY_CREATE_SOFTWARE_RELATIONS" name="C__MODULE__JDISC__ONLY_CREATE_SOFTWARE_RELATIONS" [{if $import_all_software}]checked="checked"[{/if}] class="collapsible collapsible-software_rules" />
                </td>
            </tr>
            <tr class="software_rules [{if !$import_all_software}]hide[{/if}]">
                <td class="key vat">
                    [{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_LOCATION__IMPORT_MODE' ident='LC__MODULE__JDISC__SOFTWARE_IMPORT__LOCATION'}]
                </td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__SOFTWARE_LOCATION__IMPORT_MODE"}]
                    <br class="cb" />
                    <div class="mt5 ">
                        [{isys type="f_popup" name="C__MODULE__JDISC__SOFTWARE_LOCATION"}]
                    </div>
                </td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_IMPORT__LICENCES' ident='LC__MODULE__JDISC__SOFTWARE_IMPORT__LICENCES'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__SOFTWARE_IMPORT__LICENCES" name="C__MODULE__JDISC__SOFTWARE_IMPORT__LICENCES" [{if $import_software_licences}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_IMPORT__SERVICES' ident='LC__MODULE__JDISC__SOFTWARE_IMPORT__SERVICES'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__SOFTWARE_IMPORT__SERVICES" name="C__MODULE__JDISC__SOFTWARE_IMPORT__SERVICES" [{if $import_software_services}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_IMPORT__CLOUD_SUBSCRIPTIONS' ident='LC__MODULE__JDISC__SOFTWARE_IMPORT__CLOUD_SUBSCRIPTIONS'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__SOFTWARE_IMPORT__CLOUD_SUBSCRIPTIONS" name="C__MODULE__JDISC__SOFTWARE_IMPORT__CLOUD_SUBSCRIPTIONS" [{if $import_cloud_subscriptions}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CREATE_CLOUD_USERS' ident='LC__MODULE__JDISC__CREATE_CLOUD_USERS'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__CREATE_CLOUD_USERS" name="C__MODULE__JDISC__CREATE_CLOUD_USERS" [{if $importCreateCloudUsers}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__USE_SIMPLE_DATABASE_MODEL' ident='LC__MODULE__JDISC__USE_SIMPLE_DATABASE_MODEL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__USE_SIMPLE_DATABASE_MODEL" name="C__MODULE__JDISC__USE_SIMPLE_DATABASE_MODEL" [{if $useSimpleDatabaseModel}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr class="software_rules [{if !$import_all_software}]hide[{/if}]">
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_FILTER' ident='LC__MODULE__JDISC__PROFILES__SOFTWARE_FILTER'}]</td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__SOFTWARE_FILTER_TYPE"}]
                    <br class="cb" />
                    [{isys type="f_textarea" name="C__MODULE__JDISC__SOFTWARE_FILTER" p_strClass="mt5"}]
                </td>
            </tr>
            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_FILTER_TYPE_REGEXP' ident='LC__MODULE__JDISC__PROFILES__SOFTWARE_FILTER_TYPE_REGEXP'}]</td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__SOFTWARE_FILTER_TYPE_REGEXP"}]
                </td>
            </tr>
            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__SOFTWARE_OBJ_TITEL' ident='LC__MODULE__JDISC__PROFILES__SOFTWARE_OBJ_TITEL'}]</td>
                <td class="value">[{isys type='f_dialog' name='C__MODULE__JDISC__SOFTWARE_OBJ_TITEL' p_bDbFieldNN=0}]</td>
            </tr>
        </table>
    </div>

    <div id="tab3" class="tab-content">
        <table class="contentTable" style="border-top: none;">
            <tr>
                <td class="key">[{isys type='f_label' name="C__MODULE__JDISC__CHASSIS_INTERFACE_OPTION" ident='LC__MODULE__JDISC__PROFILES__IMPORT_TYPE_INTERFACES_CHASSIS'}]</td>
                <td class="value">[{isys type="f_dialog" name="C__MODULE__JDISC__CHASSIS_INTERFACE_OPTION" p_bDbFieldNN=1}]</td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CONNECTION_ENDPOINT' ident='LC__MODULE__JDISC__IMPORT_CONNECTION_ENDPOINT'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__CONNECTION_ENDPOINT" name="C__MODULE__JDISC__CONNECTION_ENDPOINT" [{if $importConnectionEndpoint}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__ONLY_CREATE_NETWORK_RELATIONS' ident='LC__MODULE__JDISC__NETWORK_IMPORT__IMPORT_ALL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__ONLY_CREATE_NETWORK_RELATIONS" name="C__MODULE__JDISC__ONLY_CREATE_NETWORK_RELATIONS" [{if $import_all_networks}]checked="checked"[{/if}] class="collapsible collapsible-network_rules" />
                </td>
            </tr>
            <tr class="network_rules [{if !$import_all_networks}]hide[{/if}]">
                <td class="key vat">
                    [{isys type='f_label' name='C__MODULE__JDISC__NETWORK_IMPORT__RULES' ident='LC__MODULE__JDISC__NETWORK_IMPORT__RULES'}]
                </td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__NETWORK_IMPORT__RULES"}]
                    <br class="cb" />
                    [{isys type="f_textarea" name="C__MODULE__JDISC__NETWORK_IMPORT__RULES__FILTER" p_strClass="mt5"}]
                </td>
            </tr>
            <tr class="network_rules [{if !$import_all_networks}]hide[{/if}]">
                <td class="key vat">
                    [{isys type='f_label' name='C__MODULE__JDISC__NETWORK_LOCATION__IMPORT_MODE' ident='LC__MODULE__JDISC__NETWORK_IMPORT__LOCATION'}]
                </td>
                <td class="value" style="vertical-align: middle">
                    [{isys type="f_dialog" name="C__MODULE__JDISC__NETWORK_LOCATION__IMPORT_MODE"}]
                    <br class="cb" />
                    <div class="mt5 ">
                        [{isys type="f_popup" name="C__MODULE__JDISC__NETWORK_LOCATION"}]
                    </div>
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name="C__MODULE__JDISC__PROFILES__NETWORK_ADRESSES" ident='LC__MODULE__JDISC__PROFILES__NETWORK_ADRESSES'}]</td>
                <td class="value">[{isys type='f_dialog_list' name='C__MODULE__JDISC__PROFILES__NETWORK_ADRESSES' p_strStyle="width:350px;"}]</td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name="C__MODULE__JDISC__IMPORT_TYPE_DHCP_ADRESSES" ident='LC__MODULE__JDISC__PROFILES__IMPORT_TYPE_DHCP_ADRESSES'}]</td>
                <td class="value">[{isys type="f_dialog" name="C__MODULE__JDISC__IMPORT_TYPE_DHCP_ADRESSES" p_bDbFieldNN=1}]</td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CREATE_VLAN_RELATIONS' ident='LC__MODULE__JDISC__VLAN_IMPORT__IMPORT_ALL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__CREATE_VLAN_RELATIONS" name="C__MODULE__JDISC__CREATE_VLAN_RELATIONS" [{if $import_all_vlans}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CREATE_CLUSTER' ident='LC__MODULE__JDISC__CLUSTER_IMPORT__IMPORT_ALL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__CREATE_CLUSTER" name="C__MODULE__JDISC__CREATE_CLUSTER" [{if $import_all_clusters}]checked="checked"[{/if}] />
                </td>
            </tr>

            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CREATE_BLADE_CONNECTIONS' ident='LC__MODULE__JDISC__BLADE_CONNECTIONS_IMPORT__IMPORT_ALL'}]</td>
                <td class="value pl20" style="vertical-align: middle">
                    <input type="checkbox" [{if !$editMode}]disabled="disabled"[{/if}] id="C__MODULE__JDISC__CREATE_BLADE_CONNECTIONS" name="C__MODULE__JDISC__CREATE_BLADE_CONNECTIONS" [{if $import_all_blade_connections}]checked="checked"[{/if}] />
                </td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CHASSIS_ASSIGNED_MODULES_OBJTYPE' ident='LC__MODULE__JDISC__PROFILES__CHASSIS_ASSIGNED_OBJTYPE'}]</td>
                <td class="value">[{isys type="f_dialog" name="C__MODULE__JDISC__CHASSIS_ASSIGNED_MODULES_OBJTYPE" p_bDbFieldNN=1}]</td>
            </tr>
            <tr>
                <td class="key">[{isys type='f_label' name='C__MODULE__JDISC__CHASSIS_ASSIGNED_MODULES_UPDATE_OBJTYPE' ident='LC__MODULE__JDISC__PROFILES__CHASSIS_ASSIGNED_MODULES_UPDATE_OBJTYPE'}]</td>
                <td class="value">[{isys type="f_dialog" name="C__MODULE__JDISC__CHASSIS_ASSIGNED_MODULES_UPDATE_OBJTYPE" p_bDbFieldNN=1 p_arData=get_smarty_arr_YES_NO()}]</td>
            </tr>
            <tr>
                <td class="key vat">[{isys type='f_label' name='C__MODULE__JDISC__RESOLVE_FQDN' ident='LC__MODULE__JDISC__RESOLVE_FQDN'}]</td>
                <td class="value">[{isys type='f_dialog' name='C__MODULE__JDISC__RESOLVE_FQDN' p_bDbFieldNN=1 p_arData=get_smarty_arr_YES_NO()}]</td>
            </tr>
        </table>
    </div>
    <input type="hidden" id="module-jdisc-import-filter-type" value="">
    [{isys type="f_text" name="module-jdisc-import-filter-data" p_bInvisible=true}]
</div>
<input type="hidden" id="macCategoriesString" name="macCategoriesString" value="[{$macCategoriesString}]" />
<script type="text/javascript">
    (function () {
        'use strict';

        // @see ID-8267 hide SAVE button to stop user from saving early
        if ($('navbar_item_C__NAVMODE__SAVE')) {
            $('navbar_item_C__NAVMODE__SAVE').addClassName('hide');
        }

        document.observe("dom:loaded", function() {
            if ($('navbar_item_C__NAVMODE__SAVE')) {
                $('navbar_item_C__NAVMODE__SAVE').removeClassName('hide');
            }

            if ($('module-jdisc-import-filter-data').value != '' &&
                $('C__MODULE__JDISC__IMPORT__FILTER__ADDRESS')
            ) {
                $('C__MODULE__JDISC__IMPORT__FILTER__ADDRESS').value = $('module-jdisc-import-filter-data').value;
            }

            $('C__MODULE__JDISC__IMPORT__FILTER__ADDRESS').on('change', function (ele) {
                $('module-jdisc-import-filter-data').value = ele.findElement().value;
            });

            var $updateObjectTitle = $('C__MODULE__JDISC__UPDATE_OBJ_TITLE'),
                $resolveFqdn = $('C__MODULE__JDISC__RESOLVE_FQDN'),
                $syncProfileFilter = $('C__MODULE__JDISC__SYNC_CONFIG__FILTER'),
                $categorySelection = $('C__MODULE__JDISC__PROFILES__CATEGORIES__selected_box');

            // collaplsibe elements handler
            const collapsibleElements = $$('.collapsible');

            new Tabs('tabs').activate(0);

            window.applyColumnSettings(JSON.parse($('C__MODULE__JDISC__COLUMN_SETTINGS').value));

            if ($syncProfileFilter) {
                $syncProfileFilter.on('change', function (ele) {
                    var l_id = ele.findElement().value;

                    $$('.import_filter').each(function (ele) {
                        ele.hide();
                    });
                    $$(' .' + l_id).each(function (ele) {
                        ele.show();
                    });

                    $('module-jdisc-import-filter-type').value = l_id;
                });
            }

            if ($categorySelection) {
                $categorySelection.on('change', function () {
                    const categories = this.getValue();
                    const macCategories = $('macCategoriesString').getValue().split(',');
                    if (categories.some(category => macCategories.includes(category))) {
                        $$('.mac_rules')[0].toggleClassName('hide', false);
                    } else {
                        $$('.mac_rules')[0].toggleClassName('hide', true);
                    }
                });
            }

            if ($updateObjectTitle) {
                if ($updateObjectTitle.value < 1) {
                    $resolveFqdn.disable();
                }

                $updateObjectTitle.on('change', function () {
                    if (this.value > 0) {
                        $resolveFqdn.enable()
                        return;
                    }
                    $resolveFqdn.disable()
                });
            }

            collapsibleElements.forEach(element => {
                element.on('change', function() {
                    let collapsedClass = '';
                    this.className.split(' ').forEach(classItem => {
                        classItem = classItem.trim();
                        if (classItem.indexOf('collapsible-') !== -1) {
                            collapsedClass = classItem.replace('collapsible-', '');
                        }
                    });
                    if (collapsedClass) {
                        $$('.' + collapsedClass).forEach(element => {
                            element.toggleClassName('hide');
                        });
                    }
                });
            });

            $('column-settings').on('click', function () {
                new Ajax.Request('[{isys_application::instance()->container->get('route_generator')->generate('jdisc.sync-profile.popup.column-settings', ['id' => $id])}]', {
                    method:     'get',
                    onComplete: function (xhr) {
                        if (!is_json_response(xhr, true)) {
                            return;
                        }

                        const json = xhr.responseJSON;

                        Modal.open(json.data, { maxWidth: 273, maxHeight: 384 });
                    }
                });
            });

            $('C__MODULE__JDISC__SYNC_CONFIG__JDISC_SERVERS').on('change', function() {
                new Ajax.Request('?call=jdisc&ajax=1&func=get_groups_and_profiles',
                    {
                        parameters: {
                            jdisc_server: $('C__MODULE__JDISC__SYNC_CONFIG__JDISC_SERVERS').value
                        },
                        method: "post",
                        onComplete: function (transport) {
                            var json = transport.responseJSON;
                            var groups = $('C__MODULE__JDISC__SYNC_CONFIG__GROUP');
                            var firstOption = groups.options[0].cloneNode(true);

                            groups.update(firstOption);

                            if (!json.success) {
                                idoit.Notify.error(json.message);
                                return;
                            }

                            if(json.success && json.data.groups !== false)
                            {
                                var jdiscGroups = $H(json.data.groups);
                                jdiscGroups.each(function(item){
                                    groups.insert(new Element('option', {value:item.key}).insert(item.value));
                                });
                            }
                        }
                    }
                );
            });
        });
    })();
</script>
