<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="weltpixel_infinite_scroll" translate="label" type="text" sortOrder="180" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Ajax Catalog and Infinite Scroll</label>
            <tab>weltpixel</tab>
            <resource>WeltPixel_AjaxInfiniteScroll::AjaxInfiniteScroll</resource>
            <group id="general_module_information" translate="label" type="text" sortOrder="0" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Ajax Catalog and Infinite Scroll</label>
                <attribute type="expanded">1</attribute>
                <fieldset_css>weltpixel-module-information-header active</fieldset_css>
                <field id="separator_product_dimensions" translate="button_label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    <frontend_model>WeltPixel\Backend\Block\Adminhtml\System\Config\ModuleInformation</frontend_model>
                    <button_label>WeltPixel_AjaxInfiniteScroll</button_label>
                </field>
            </group>
            <group id="general" translate="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>General Settings</label>
                <field id="ajax_catalog" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable Ajax Catalog</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment/>
                </field>
                <field id="ajax_catalog_mode" translate="label comment" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Ajax Catalog Mode</label>
                    <source_model>WeltPixel\AjaxInfiniteScroll\Model\Config\Source\AjaxCatalog</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
                <field id="ajax_catalog_category" translate="label comment" type="select" sortOrder="120" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Use Ajax Catalog On Category Page</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
                <field id="ajax_catalog_search" translate="label comment" type="select" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Use Ajax Catalog On Search Page</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
                <field id="ajax_catalog_advanced" translate="label comment" type="select" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Use Ajax Catalog On Advanced Search Page</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
            </group>
            <group id="advanced" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Advanced Settings</label>
                <field id="text_loading" translate="label comment" type="text" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>"Loading More Items" Text</label>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
                <field id="show_viewed_products" translate="label comment" type="select" sortOrder="205" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Show number of already viewed and remaining products</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                    </depends>
                </field>
                <field id="show_viewed_products_text" translate="label comment" type="text" sortOrder="206" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Text for "Show number of already viewed and remaining products"</label>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                        <field id="weltpixel_infinite_scroll/advanced/show_viewed_products">1</field>
                    </depends>
                    <comment><![CDATA[<b>Ex</b>: You've seen %1 of %2 products]]></comment>
                </field>
                <field id="load_more" translate="label comment" type="text" sortOrder="210" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Show "Load More" Button</label>
                    <validate>validate-digits</validate>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                    </depends>
                    <comment>"Load More" button will show after specified number of pages. If 0, "Load More" button will never display.</comment>
                </field>
                <field id="text_loadnext" translate="label comment" type="text" sortOrder="220" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>"Load More" Button Text</label>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                    </depends>
                    <comment/>
                </field>
                <field id="text_loadprevious" translate="label comment" type="text" sortOrder="225" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>"Load Previous items" Button Text</label>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                    </depends>
                    <comment/>
                </field>
                <field id="text_nomore" translate="label comment" type="text" sortOrder="230" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>"No More Items" Text</label>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment/>
                </field>
                <field id="loading_early" translate="label comment" type="select" sortOrder="240" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Start Loading Early</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                    </depends>
                    <comment/>
                </field>
                <field id="negative_margin" translate="label comment" type="text" sortOrder="250" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Negative Margin</label>
                    <validate>validate-digits</validate>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog_mode">infinite_scroll</field>
                        <field id="weltpixel_infinite_scroll/advanced/loading_early">1</field>
                    </depends>
                    <comment>Load new items earlier considering the pixels offset configured. More items will start loading when you have less than specified pixels until the bottom of the
                        page. Ex. 250.</comment>
                </field>
                <field id="prev_next" translate="label comment" type="select" sortOrder="260" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable canonical and prev/next link elements</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/ajax_catalog">1</field>
                    </depends>
                    <comment>This helps search engines more accurately index your content and serve to users the most relevant page.</comment>
                </field>
                <field id="use_custom_loading_placeholder" translate="label comment" type="select" sortOrder="270" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Custom Loading Placeholder</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/enable">1</field>
                    </depends>
                    <comment><![CDATA[Enable to be able to choose your own placeholder for the loading period of the images. <br>
                                Below you can upload your own file.]]></comment>
                </field>
                <field id="loading_image" translate="label comment" type="image" sortOrder="280" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Loading Image</label>
                    <backend_model>WeltPixel\AjaxInfiniteScroll\Model\Config\Backend\Svg</backend_model>
                    <upload_dir config="system/filesystem/media" scope_info="1">weltpixel/ajaxinfinitescroll/loadingimage</upload_dir>
                    <base_url type="media" scope_info="1">weltpixel/ajaxinfinitescroll/loadingimage</base_url>
                    <comment><![CDATA[ Only 'jpg', 'jpeg', 'gif', 'png', 'svg' is allowed.]]>
                    </comment>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/enable">1</field>
                        <field id="weltpixel_infinite_scroll/advanced/use_custom_loading_placeholder">1</field>
                    </depends>
                </field>
                <field id="placeholder_width" translate="label comment" type="text" sortOrder="290" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Placeholder Width</label>
                    <validate>validate-digits</validate>
                    <depends>
                        <field id="weltpixel_infinite_scroll/general/enable">1</field>
                        <field id="weltpixel_infinite_scroll/advanced/use_custom_loading_placeholder">1</field>
                    </depends>
                    <comment>Insert the maximum width of the placeholder in pixels. For example insert 50 for a width of 50px.</comment>
                </field>
                <comment>
                    <![CDATA[
                        <script type="text/javascript">
                            require(['jquery', 'domReady!'], function(){
                                if (jQuery('#weltpixel_infinite_scroll_general_ajax_catalog').val() != 1){
                                    jQuery('#weltpixel_infinite_scroll_advanced').closest('.section-config').hide();
                                }

                                jQuery('#weltpixel_infinite_scroll_general_ajax_catalog').on('change', function(){
                                    if (this.value != 1) {
                                        jQuery('#weltpixel_infinite_scroll_advanced').closest('.section-config').hide();
                                    } else {
                                        jQuery('#weltpixel_infinite_scroll_advanced').closest('.section-config').show();
                                    }
                                })
                            });
                        </script>
                    ]]>
                </comment>
            </group>
        </section>
    </system>
</config>
