Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSI: UI part of product assignment from source page #37

Merged
merged 1 commit into from
Jul 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public function getData()
$sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId);
$dataForSingle[$sourceId] = [
'general' => $sourceGeneralData,
'products' => [
'assigned_products' => [
],
],
];
$data = $dataForSingle;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,182 @@
</formElements>
</field>
</fieldset>
<fieldset name="products" sortOrder="50">
<settings>
<label translate="true">Products</label>
<collapsible>true</collapsible>
<opened>true</opened>
<dataScope>products</dataScope>
</settings>
<container name="assign_products_container">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/group</item>
<item name="label" xsi:type="string"/>
<item name="dataScope" xsi:type="string"/>
<item name="sortOrder" xsi:type="number">10</item>
<item name="breakLine" xsi:type="boolean">false</item>
</item>
</argument>
<container name="assign_products_button">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">container</item>
<item name="component" xsi:type="string">Magento_Ui/js/form/components/button</item>
<item name="template" xsi:type="string">ui/form/components/button/container</item>
<item name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="targetName" xsi:type="string">inventory_source_form.inventory_source_form.products.assign_products_modal</item>
<item name="actionName" xsi:type="string">toggleModal</item>
</item>
</item>
<item name="title" xsi:type="string" translate="true">Assign Products</item>
<item name="additionalForGroup" xsi:type="boolean">true</item>
<item name="additionalClasses" xsi:type="string">admin__field-medium</item>
<item name="dataScope" xsi:type="string"/>
</item>
</argument>
</container>
</container>
<dynamicRows name="assigned_products">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string">Assigned Products</item>
<item name="renderDefaultRecord" xsi:type="boolean">false</item>
<item name="component" xsi:type="string">Magento_Ui/js/dynamic-rows/dynamic-rows-grid</item>
<item name="addButton" xsi:type="boolean">false</item>
<item name="recordTemplate" xsi:type="string">record</item>
<item name="dataScope" xsi:type="string"/>
<item name="dataProvider" xsi:type="string">data.products.assign_products_grid</item>
<item name="sortOrder" xsi:type="number">100</item>
<item name="map" xsi:type="array">
<item name="entity_id" xsi:type="string">entity_id</item>
<item name="name" xsi:type="string">name</item>
<item name="sku" xsi:type="string">sku</item>
</item>
<item name="identificationProperty" xsi:type="string">entity_id</item>
<item name="identificationDRProperty" xsi:type="string">entity_id</item>
<item name="links" xsi:type="array">
<item name="insertData" xsi:type="string">${ $.provider }:${ $.dataProvider }</item>
</item>
<item name="dndConfig" xsi:type="array">
<item name="enabled" xsi:type="boolean">false</item>
</item>
<item name="renderColumnsHeader" xsi:type="boolean">true</item>
</item>
</argument>
<container name="record">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="isTemplate" xsi:type="boolean">true</item>
<item name="is_collection" xsi:type="boolean">true</item>
<item name="component" xsi:type="string">Magento_Ui/js/dynamic-rows/record</item>
<item name="dataScope" xsi:type="string"/>
</item>
</argument>
<field name="entity_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">input</item>
<item name="elementTmpl" xsi:type="string">ui/dynamic-rows/cells/text</item>
<item name="dataType" xsi:type="string">text</item>
<item name="dataScope" xsi:type="string">entity_id</item>
<item name="fit" xsi:type="boolean">false</item>
<item name="label" xsi:type="string" translate="true">ID</item>
</item>
</argument>
</field>
<field name="name">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">input</item>
<item name="elementTmpl" xsi:type="string">ui/dynamic-rows/cells/text</item>
<item name="dataType" xsi:type="string">text</item>
<item name="dataScope" xsi:type="string">name</item>
<item name="componentType" xsi:type="string">field</item>
<item name="label" xsi:type="string" translate="true">Name</item>
</item>
</argument>
</field>
<field name="sku">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="formElement" xsi:type="string">input</item>
<item name="elementTmpl" xsi:type="string">ui/dynamic-rows/cells/text</item>
<item name="dataType" xsi:type="string">text</item>
<item name="dataScope" xsi:type="string">sku</item>
<item name="componentType" xsi:type="string">field</item>
<item name="label" xsi:type="string" translate="true">SKU</item>
</item>
</argument>
</field>
<field name="actionDelete">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">actionDelete</item>
<item name="label" xsi:type="string" translate="true">Unassign</item>
</item>
</argument>
</field>
</container>
</dynamicRows>
<modal name="assign_products_modal">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataScope" xsi:type="string"/>
<item name="provider" xsi:type="string">inventory_source_form.inventory_source_form_data_source</item>
<item name="options" xsi:type="array">
<item name="title" xsi:type="string">Assign Products</item>
<item name="buttons" xsi:type="array">
<item name="0" xsi:type="array">
<item name="text" xsi:type="string">Cancel</item>
<item name="class" xsi:type="string">action-secondary</item>
<item name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="targetName" xsi:type="string">${ $.name }</item>
<item name="actionName" xsi:type="string">actionCancel</item>
</item>
</item>
</item>
<item name="1" xsi:type="array">
<item name="text" xsi:type="string" translate="true">Done</item>
<item name="class" xsi:type="string">action-primary</item>
<item name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="targetName" xsi:type="string">index = assign_products_grid</item>
<item name="actionName" xsi:type="string">save</item>
</item>
<item name="1" xsi:type="array">
<item name="targetName" xsi:type="string">${ $.name }</item>
<item name="actionName" xsi:type="string">actionDone</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
<insertListing name="assign_products_grid">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="autoRender" xsi:type="string">false</item>
<item name="dataScope" xsi:type="string">assign_products_grid</item>
<item name="ns" xsi:type="string">product_listing</item>
<item name="externalProvider" xsi:type="string">product_listing.product_listing_data_source</item>
<item name="selectionsProvider" xsi:type="string">product_listing.product_listing.product_columns.ids</item>
<item name="render_url" xsi:type="url" path="mui/index/render"/>
<item name="realTimeLink" xsi:type="boolean">true</item>
<item name="dataLinks" xsi:type="array">
<item name="imports" xsi:type="boolean">false</item>
<item name="exports" xsi:type="boolean">true</item>
</item>
<item name="externalFilterMode" xsi:type="boolean">true</item>
<item name="cssclass" xsi:type="string">noclass</item>
</item>
</argument>
</insertListing>
</modal>
</fieldset>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ define([
return false;
}

changes.each(function (changedObject) {
changes.forEach(function (changedObject) {
this.mappingValue(changedObject);
}, this);
}
Expand Down Expand Up @@ -266,7 +266,7 @@ define([
changes = [],
obj = {};

max.each(function (record, index) {
max.forEach(function (record, index) {
obj[this.map[this.identificationDRProperty]] = record[this.map[this.identificationDRProperty]];

if (!_.where(this.cacheGridData, obj).length) {
Expand Down