Skip to content

Commit

Permalink
Merge pull request #32 from magento-engcom/source-management-ui-lars
Browse files Browse the repository at this point in the history
work on region fields, system configuration of default carriers
  • Loading branch information
Valeriy Nayda committed Jun 23, 2017
2 parents 43e37e1 + 6f6f204 commit 40f8b89
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function processSave($sourceId, array $requestData)
/** @var SourceInterface $source */
$source = $this->sourceFactory->create();
}
$source = $this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class);
$this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class);
$source = $this->carrierRequestDataHydrator->hydrate($source, $requestData);

$sourceId = $this->sourceRepository->save($source);
Expand Down
32 changes: 32 additions & 0 deletions app/code/Magento/Inventory/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="inventory" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Inventory (MSI)</label>
<tab>catalog</tab>
<resource>Magento_Inventory::inventory</resource>
<group id="inventory_source_carriers" translate="label" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Source default carrier config</label>
<field id="use_enabled_carriers" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Use Enabled Carriers</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="inventory_source_default_carrier_config" type="multiselect" translate="label" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0">
<label>Specify Carriers</label>
<source_model>Magento\Inventory\Model\OptionSource\CarrierSource</source_model>
<can_be_empty>1</can_be_empty>
<comment>Use Ctrl+click for unset value</comment>
<depends>
<field id="use_enabled_carriers">0</field>
</depends>
</field>
</group>
</section>
</system>
</config>
16 changes: 16 additions & 0 deletions app/code/Magento/Inventory/etc/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<inventory>
<inventory_source_carriers>
<use_enabled_carriers>1</use_enabled_carriers>
</inventory_source_carriers>
</inventory>
</default>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@
<select>
<settings>
<options class="Magento\Inventory\Model\OptionSource\RegionSource"/>
<filterBy>
<field>country_id</field>
<target>${ $.provider }:${ $.parentScope }.country_id</target>
</filterBy>
<customEntry>region</customEntry>
</settings>
</select>
</formElements>
Expand All @@ -201,6 +206,7 @@
<settings>
<dataType>text</dataType>
<label translate="true">State/Province</label>
<visible>false</visible>
</settings>
</field>
<field name="city" formElement="input" sortOrder="40">
Expand Down Expand Up @@ -229,10 +235,15 @@
<settings>
<label translate="true">Carriers</label>
<collapsible>true</collapsible>
<opened>true</opened>
<opened>false</opened>
<dataScope>general</dataScope>
</settings>
<field name="use_default_carrier_config" formElement="checkbox" sortOrder="10">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="default" xsi:type="number">1</item>
</item>
</argument>
<settings>
<label translate="true">Use global Shipping configuration</label>
<dataType>boolean</dataType>
Expand All @@ -253,7 +264,7 @@
<settings>
<label translate="true">Shipping methods</label>
<imports>
<link name="disabled">${$.parentName}.use_default_carrier_config:checked</link>
<link name="visible">!${$.parentName}.use_default_carrier_config:checked</link>
</imports>
</settings>
<formElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
</column>
<column name="country_id" component="Magento_Ui/js/grid/columns/select" sortOrder="80">
<settings>
<options class="Magento\Directory\Model\Config\Source\Country"/>
<visible>false</visible>
<filter>select</filter>
<dataType>select</dataType>
Expand All @@ -182,6 +183,7 @@
</column>
<column name="region_id" component="Magento_Ui/js/grid/columns/select" sortOrder="90">
<settings>
<options class="Magento\Inventory\Model\OptionSource\RegionSource"/>
<visible>false</visible>
<filter>select</filter>
<dataType>select</dataType>
Expand Down

0 comments on commit 40f8b89

Please sign in to comment.