<?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>
        <tab id="meetanshi" translate="label" class="meetanshi" sortOrder="100">
            <label></label>
        </tab>
        <section id="ordernumber" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
                 showInStore="1">
            <resource>Meetanshi_OrderNumber::custom_order_config</resource>
            <class>separator-top</class>
            <label>Custom Order Number</label>
            <tab>meetanshi</tab>
            <group id="order" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="1">
                <label>Order Configuration</label>
                <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Custom Order Number For Order</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
                <field id="format" translate="label comment" type="text" sortOrder="2" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Order Number Format</label>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                    <comment>
                        <![CDATA[
                    <strong>Sample formats:</strong><br/>
                    ORD-{counter} (if {counter} is 100075 this outputs ORD-100075)<br/>
                    O-{YYYY}-{counter} (if {counter} is 1099 and year is 2018 this outputs O-2018-1099)<br/><br/>
                    <strong>The following variables can be used:</strong><br/>
                    {d} = day of the month<br/>
                    {dd} = day of the month<br/>
                    {m} = month of the year<br/>
                    {mm} = month of the year, 2 digits<br/>
                    {yy} = current year, 2 digits<br/>
                    {yyyy} = current year, 4 digits<br/>
                    {h} = current time: hour<br/>
                    {hh} = current time: hour, 2 digits<br/>
                    {ii} = current time: minute, 2 digits<br/>
                    {ss} = current time: seconds, 2 digits<br/>
                    {store_id} = Current store id<br/>
                    {counter} = Counter Increment By Value, configuration below<br/>
                    {rand2} = Random number between 10 and 99<br/>
                    {rand3} = Random number between 100 and 999<br/>
                    {rand4} = Random number between 1000 and 9999<br/>
                    {rand5} = Random number between 10000 and 99999<br/>
                    {rand6} = Random number between 100000 and 999999<br/>
                    {rand7} = Random number between 1000000 and 9999999<br/>
                    {rand8} = Random number between 10000000 and 99999999<br/>
                    {rand9} = Random number between 100000000 and 999999999
                    ]]></comment>
                </field>
                <field id="count" translate="label comment" type="text" sortOrder="3" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Start From</label>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="per_website" translate="label comment" type="select" sortOrder="4" showInDefault="0"
                       showInWebsite="1" showInStore="0">
                    <label>Unique Counter per Website</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This website should have its own counter.]]></comment>
                </field>
                <field id="per_store" translate="label comment" type="select" sortOrder="5" showInDefault="0"
                       showInWebsite="0" showInStore="1">
                    <label>Unique Counter per Store View</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This store view should have its own counter.]]></comment>
                </field>
                <field id="increment" translate="label comment" type="text" sortOrder="6" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Increment By</label>
                    <comment>
                        <![CDATA[E.g. the last number is 10020. If increment step is 5, the next number will be 10025]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="padding" translate="label comment" type="text" sortOrder="7" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Padding</label>
                    <comment>
                        <![CDATA[Total number of digits in the order number. If the order id is 20 and padding is 8, the result will be 00000020. Set to 0 (zero) not to add leading zeros.]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="reset" translate="label comment" type="select" sortOrder="8" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter on Date Change</label>
                    <source_model>Meetanshi\OrderNumber\Model\System\Config\Source\Counter</source_model>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="force_reset" translate="label comment" type="select" sortOrder="9" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>
                        <![CDATA[If set to 'Yes', the {counter} variable will be reset when the next increment ID is generated and will than deactivate this option automatically.]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
            </group>
            <group id="invoice" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="2">
                <label>Invoice Configuration</label>
                <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Enable Custom Invoice Number</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
                <field id="same" translate="label comment" type="select" sortOrder="2" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Same as Order Number</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends><field id="enabled">1</field></depends>
                </field>
                <field id="prefix" translate="label comment" type="text" sortOrder="3" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Invoice Prefix</label>
                    <comment><![CDATA[Added prefix will be added before the order number]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="replace_with" translate="label comment" type="text" sortOrder="4" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Add Order Prefix to Replace With Invoice Prefix</label>
                    <comment>
                        <![CDATA[Add the prefix of the order you want to replace with the above invoice prefix. If your Invoice Prefix is ENV and Order Number Format is `ORD-{yy}-{counter}`, add `ORD` here to replace with INV instead of adding it in the beginning.]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="format" translate="label comment" type="text" sortOrder="5" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Invoice Number Format</label>
                    <comment>
                        <![CDATA[
                    <strong>Sample formats:</strong><br/>
                    ORD-{counter} (if {counter} is 100075 this outputs ORD-100075)<br/>
                    O-{YYYY}-{counter} (if {counter} is 1099 and year is 2018 this outputs O-2018-1099)<br/><br/>
                    <strong>The following variables can be used:</strong><br/>
                    {d} = day of the month<br/>
                    {dd} = day of the month<br/>
                    {m} = month of the year<br/>
                    {mm} = month of the year, 2 digits<br/>
                    {yy} = current year, 2 digits<br/>
                    {yyyy} = current year, 4 digits<br/>
                    {h} = current time: hour<br/>
                    {hh} = current time: hour, 2 digits<br/>
                    {ii} = current time: minute, 2 digits<br/>
                    {ss} = current time: seconds, 2 digits<br/>
                    {store_id} = Current store id<br/>
                    {counter} = Counter Increment By Value, configuration below<br/>
                    {rand2} = Random number between 10 and 99<br/>
                    {rand3} = Random number between 100 and 999<br/>
                    {rand4} = Random number between 1000 and 9999<br/>
                    {rand5} = Random number between 10000 and 99999<br/>
                    {rand6} = Random number between 100000 and 999999<br/>
                    {rand7} = Random number between 1000000 and 9999999<br/>
                    {rand8} = Random number between 10000000 and 99999999<br/>
                    {rand9} = Random number between 100000000 and 999999999
                    ]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="count" translate="label comment" type="text" sortOrder="6" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Start From</label>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_website" translate="label comment" type="select" sortOrder="7" showInDefault="0"
                       showInWebsite="1" showInStore="0">
                    <label>Unique Counter per Website</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This website should have its own counter.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_store" translate="label comment" type="select" sortOrder="8" showInDefault="0"
                       showInWebsite="0" showInStore="1">
                    <label>Unique Counter per Store View</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[This store view should have its own counter.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="increment" translate="label comment" type="text" sortOrder="9" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Increment By</label>
                    <comment>
                        <![CDATA[E.g. the last number is 10020. If increment step is 5, the next number will be 10025]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="padding" translate="label comment" type="text" sortOrder="10" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Padding</label>
                    <comment>
                        <![CDATA[Total number of digits in the order number. If the order id is 20 and padding is 8, the result will be 00000020. Set to 0 (zero) not to add leading zeros.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="reset" translate="label comment" type="select" sortOrder="11" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter on Date Change</label>
                    <source_model>Meetanshi\OrderNumber\Model\System\Config\Source\Counter</source_model>
                    <comment>
                        <![CDATA[How often should the %counter% variable be reset? Make sure to have dynamic parts (like the date) in the invoice number format to avoid duplicate invoice numbers!]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="force_reset" translate="label comment" type="select" sortOrder="12" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>
                        <![CDATA[If set to 'Yes', the {counter} variable will be reset when the next increment ID is generated and will than deactivate this option automatically.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
            </group>
            <group id="shipment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="3">
                <label>Shipment Configuration</label>
                <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Custom Order Number For Shipment</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
                <field id="same" translate="label comment" type="select" sortOrder="2" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Same as Order Number</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends><field id="enabled">1</field></depends>
                </field>
                <field id="prefix" translate="label comment" type="text" sortOrder="3" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Shipment Prefix</label>
                    <comment><![CDATA[Will be added before the order number]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="replace_with" translate="label comment" type="text" sortOrder="4" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Add Order Prefix to Replace With Shipment Prefix</label>
                    <comment>
                        <![CDATA[Add the prefix of the order you want to replace with the above shipment prefix. If your Shipment Prefix is SHIP and Order Number Format is `ORD-{yy}-{counter}`, add `ORD` here to replace with SHIP instead of adding it in the beginning.]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="format" translate="label comment" type="text" sortOrder="5" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Shipment Number Format</label>
                    <comment>
                        <![CDATA[
                    <strong>Sample formats:</strong><br/>
                    ORD-{counter} (if {counter} is 100075 this outputs ORD-100075)<br/>
                    O-{YYYY}-{counter} (if {counter} is 1099 and year is 2018 this outputs O-2018-1099)<br/><br/>
                    <strong>The following variables can be used:</strong><br/>
                    {d} = day of the month<br/>
                    {dd} = day of the month<br/>
                    {m} = month of the year<br/>
                    {mm} = month of the year, 2 digits<br/>
                    {yy} = current year, 2 digits<br/>
                    {yyyy} = current year, 4 digits<br/>
                    {h} = current time: hour<br/>
                    {hh} = current time: hour, 2 digits<br/>
                    {ii} = current time: minute, 2 digits<br/>
                    {ss} = current time: seconds, 2 digits<br/>
                    {store_id} = Current store id<br/>
                    {counter} = Counter Increment By Value, configuration below<br/>
                    {rand2} = Random number between 10 and 99<br/>
                    {rand3} = Random number between 100 and 999<br/>
                    {rand4} = Random number between 1000 and 9999<br/>
                    {rand5} = Random number between 10000 and 99999<br/>
                    {rand6} = Random number between 100000 and 999999<br/>
                    {rand7} = Random number between 1000000 and 9999999<br/>
                    {rand8} = Random number between 10000000 and 99999999<br/>
                    {rand9} = Random number between 100000000 and 999999999
                    ]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="count" translate="label comment" type="text" sortOrder="6" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Start From</label>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_website" translate="label comment" type="select" sortOrder="7" showInDefault="0"
                       showInWebsite="1" showInStore="0">
                    <label>Unique Counter per Website</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_store" translate="label comment" type="select" sortOrder="8" showInDefault="0"
                       showInWebsite="0" showInStore="1">
                    <label>Unique Counter per Store View</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="increment" translate="label comment" type="text" sortOrder="9" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Increment By</label>
                    <comment>
                        <![CDATA[E.g. the last number is 10020. If increment step is 5, the next number will be 10025]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="padding" translate="label comment" type="text" sortOrder="10" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Padding</label>
                    <comment>
                        <![CDATA[If you want the %counter% variable to be 6 digits long with zeros at the beginning of the counter, enter 6 in this field. For example if the counter is at 12, it would output 000012 then, so it's always a 6 digit number (6 is the padding).]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="reset" translate="label comment" type="select" sortOrder="11" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter on Date Change</label>
                    <source_model>Meetanshi\OrderNumber\Model\System\Config\Source\Counter</source_model>
                    <comment>
                        <![CDATA[How often should the %counter% variable be reset? Make sure to have dynamic parts (like the date) in the shipment number format to avoid duplicate shipment numbers!]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="force_reset" translate="label comment" type="select" sortOrder="12" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>
                        <![CDATA[If set to 'Yes', the {counter} variable will be reset when the next increment ID is generated and will than deactivate this option automatically.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
            </group>
            <group id="creditmemo" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="4">
                <label>Credit Memo Configuration</label>
                <field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Custom Order Number For Credit Memo</label>
                    <source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
                </field>
                <field id="same" translate="label comment" type="select" sortOrder="2" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Same as Order Number</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[If enabled, the credit memo number will use the order number the credit memo belongs to, which means the credit memo number is the same as the order number.]]></comment>
                    <depends><field id="enabled">1</field></depends>
                </field>
                <field id="prefix" translate="label comment" type="text" sortOrder="3" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Credit Memo Prefix</label>
                    <comment><![CDATA[Will be added before the order number]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="replace_with" translate="label comment" type="text" sortOrder="4" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Add Order Prefix to Replace With Credit Memo Prefix</label>
                    <comment>
                        <![CDATA[Add the prefix of the order you want to replace with the above Credit Memo prefix. If your Credit Memo Prefix is CM and Order Number Format is `ORD-{yy}-{counter}`, add `ORD` here to replace with CM instead of adding it in the beginning.]]></comment>
                    <depends>
                        <field id="same">1</field>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="format" translate="label comment" type="text" sortOrder="5" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Credit Memo Number Format</label>
                    <comment>
                        <![CDATA[
                    <strong>Sample formats:</strong><br/>
                    ORD-{counter} (if {counter} is 100075 this outputs ORD-100075)<br/>
                    O-{YYYY}-{counter} (if {counter} is 1099 and year is 2018 this outputs O-2018-1099)<br/><br/>
                    <strong>The following variables can be used:</strong><br/>
                    {d} = day of the month<br/>
                    {dd} = day of the month<br/>
                    {m} = month of the year<br/>
                    {mm} = month of the year, 2 digits<br/>
                    {yy} = current year, 2 digits<br/>
                    {yyyy} = current year, 4 digits<br/>
                    {h} = current time: hour<br/>
                    {hh} = current time: hour, 2 digits<br/>
                    {ii} = current time: minute, 2 digits<br/>
                    {ss} = current time: seconds, 2 digits<br/>
                    {store_id} = Current store id<br/>
                    {counter} = Counter Increment By Value, configuration below<br/>
                    {rand2} = Random number between 10 and 99<br/>
                    {rand3} = Random number between 100 and 999<br/>
                    {rand4} = Random number between 1000 and 9999<br/>
                    {rand5} = Random number between 10000 and 99999<br/>
                    {rand6} = Random number between 100000 and 999999<br/>
                    {rand7} = Random number between 1000000 and 9999999<br/>
                    {rand8} = Random number between 10000000 and 99999999<br/>
                    {rand9} = Random number between 100000000 and 999999999
                    ]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="count" translate="label comment" type="text" sortOrder="6" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Start From</label>
                    <comment>
                        <![CDATA[This is the %counter% variable that can be used in the custom credit memo number format field above. This configures from which number the %counter% variable begins counting. If you use "Reset counter", the %counter% variable will start from the value entered here after being reset.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_website" translate="label comment" type="select" sortOrder="7" showInDefault="0"
                       showInWebsite="1" showInStore="0">
                    <label>Counter: Unique per website</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="per_store" translate="label comment" type="select" sortOrder="8" showInDefault="0"
                       showInWebsite="0" showInStore="1">
                    <label>Unique Counter per Website</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="increment" translate="label comment" type="text" sortOrder="9" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Increment By</label>
                    <comment>
                        <![CDATA[E.g. the last number is 10020. If increment step is 5, the next number will be 10025]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="padding" translate="label comment" type="text" sortOrder="10" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Counter Padding</label>
                    <comment>
                        <![CDATA[Total number of digits in the order number. If the order id is 20 and padding is 8, the result will be 00000020. Set to 0 (zero) not to add leading zeros.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="reset" translate="label comment" type="select" sortOrder="11" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter on Date Change</label>
                    <source_model>Meetanshi\OrderNumber\Model\System\Config\Source\Counter</source_model>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
                <field id="force_reset" translate="label comment" type="select" sortOrder="12" showInDefault="1"
                       showInWebsite="1" showInStore="1">
                    <label>Reset Counter</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment>
                        <![CDATA[If set to 'Yes', the {counter} variable will be reset when the next increment ID is generated and will than deactivate this option automatically.]]></comment>
                    <depends>
                        <field id="same">0</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>
