Skip to content

Commit

Permalink
Add Screen Sections for ProductOtherIdentification, ProductCategoryId…
Browse files Browse the repository at this point in the history
…ent, and ProductStoreDataDocument (#132)

* Add Category Identification Section to EditCategory, Add Other Identification Section to EditProduct, Add Store Data Documents Section to EditProductStore

* Rename vague transitions, lengthy entity fields, and enumIds

* Rename storeDocumentTypeEnumId to typeEnumId
  • Loading branch information
acetousk committed Jul 13, 2022
1 parent e1d929e commit f381cea
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 11 deletions.
65 changes: 64 additions & 1 deletion screen/SimpleScreens/Catalog/Category/EditCategory.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This software is in the public domain under CC0 1.0 Universal plus a
This software is in the public domain under CC0 1.0 Universal plus a
Grant of Patent License.
To the extent possible under law, the author(s) have dedicated all
Expand All @@ -26,6 +26,16 @@ along with this software (see the LICENSE.md file). If not, see
<transition name="updateProductCategoryFeatGrpAppl"><service-call name="update#mantle.product.feature.ProductCategoryFeatGrpAppl"/>
<default-response url="."/></transition>

<transition name="createProductCategoryIdent"><service-call name="create#mantle.product.category.ProductCategoryIdent"/>
<default-response url="."/></transition>
<transition name="updateProductCategoryIdent"><service-call name="update#mantle.product.category.ProductCategoryIdent"/>
<default-response url="."/></transition>
<transition name="deleteProductCategoryIdent"><service-call name="delete#mantle.product.category.ProductCategoryIdent"/>
<default-response url="."/></transition>
<transition name="generateUrlSlugCategoryIdent">
<service-call name="mantle.product.StoreServices.generate#UrlSlugFromCategoryName"/>
<default-response url="."/></transition>

<transition name="createProductCategoryRollup"><service-call name="create#mantle.product.category.ProductCategoryRollup"
in-map="context + [productCategoryId:childProductCategoryId]"/><default-response url="."/></transition>
<transition name="updateProductCategoryRollup"><service-call name="update#mantle.product.category.ProductCategoryRollup"
Expand All @@ -39,6 +49,15 @@ along with this software (see the LICENSE.md file). If not, see
<entity-find-one entity-name="mantle.product.category.ProductCategory" value-field="category" cache="false"/>
<if condition="category == null"><return error="true" message="Category not found with ID ${productCategoryId}"/></if>
<set field="curProductCategoryId" from="productCategoryId"/>

<entity-find entity-name="moqui.basic.Enumeration" limit="200" cache="true" list="productCategoryIdentTypeList">
<econdition field-name="enumTypeId" value="ProductCategoryIdentType"/><order-by field-name="description"/></entity-find>
<entity-find entity-name="mantle.product.store.ProductStore" limit="200" cache="true" list="productStoreList">
<order-by field-name="storeName"/></entity-find>
<entity-find entity-name="mantle.marketing.segment.MarketSegment" limit="200" cache="true" list="marketSegmentList">
<order-by field-name="description"/></entity-find>
<entity-find entity-name="mantle.product.category.ProductCategoryIdent" list="pciList">
<econdition field-name="productCategoryId"/></entity-find>
</actions>
<widgets>
<container-row><row-col md="7">
Expand Down Expand Up @@ -107,6 +126,50 @@ along with this software (see the LICENSE.md file). If not, see
</default-field></field>
</form-list>
</box-body-nopad></container-box>
<container-box><box-header title="Category Identification"/><box-toolbar>
<form-single name="GenerateCategoryIdent" transition="generateUrlSlugCategoryIdent">
<field name="productCategoryId"><default-field><hidden/></default-field></field>
<field name="categoryName" from="category?.categoryName"><default-field><hidden/></default-field></field>
<field name="submitButton"><conditional-field title="Generate Url Slug" tooltip="Generate Url Slug from the Category's Name"
condition="pciList?.findAll{it.identTypeEnumId == 'PcitUrlSlug' }?.size() == 0">
<submit/></conditional-field></field></form-single>
<container-dialog id="AddCategoryIdentDialog" button-text="New Category Identification">
<form-single name="AddCategoryIdentForm" transition="createProductCategoryIdent">
<field name="productCategoryId"><default-field><hidden/></default-field></field>
<field name="productCategoryIdentId"><default-field tooltip="Id of Product Category to Product Category Ident Relationship">
<text/></default-field></field>
<field name="identTypeEnumId"><default-field title="Identity Type">
<drop-down><list-options list="productCategoryIdentTypeList" key="${enumId}" text="${description}"/></drop-down>
</default-field></field>
<field name="productStoreId"><default-field title="Product Store">
<drop-down allow-empty="true"><list-options list="productStoreList" key="${productStoreId}" text="${storeName}"/></drop-down>
</default-field></field>
<field name="marketSegmentId"><default-field>
<drop-down allow-empty="true"><list-options list="marketSegmentList" key="${marketSegmentId}" text="${description}"/></drop-down>
</default-field></field>
<field name="idValue"><default-field><text-line size="20"/></default-field></field>
<field name="submitButton"><default-field title="Apply"><submit/></default-field></field>
</form-single>
</container-dialog>
</box-toolbar><box-body>
<form-list name="CategoryIdentForm" list="pciList" transition="updateProductCategoryIdent">
<field name="productCategoryIdentId"><default-field><hidden/></default-field></field>
<field name="productCategoryId"><default-field><hidden/></default-field></field>
<field name="identTypeEnumId"><default-field title="Identity Type"><drop-down size="4">
<list-options list="productCategoryIdentTypeList" key="${enumId}" text="${description}"/>
</drop-down></default-field></field>
<field name="productStoreId"><default-field title="Product Store"><drop-down size="4" allow-empty="true">
<list-options list="productStoreList" key="${productStoreId}" text="${storeName}"/>
</drop-down></default-field></field>
<field name="marketSegmentId"><default-field title="Market Segment"><drop-down size="4" allow-empty="true">
<list-options list="marketSegmentList" key="${marketSegmentId}" text="${description}"/>
</drop-down></default-field></field>
<field name="idValue"><default-field><text-line size="20"/></default-field></field>
<field name="submitButton"><default-field title="Update"><submit/></default-field></field>
<field name="delete"><default-field title=""><link url="deleteProductCategoryIdent" text=""
icon="fa fa-trash" confirmation="Delete Product Category Identity Record?"/></default-field></field>
</form-list>
</box-body></container-box>
</widgets></section>
</row-col><row-col md="5">
<container-box><box-header title="Parent Categories"/><box-body-nopad>
Expand Down
73 changes: 66 additions & 7 deletions screen/SimpleScreens/Catalog/Product/EditProduct.xml
Expand Up @@ -33,6 +33,18 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="productIdTypeEnumId"/>
<service-call name="delete#mantle.product.ProductIdentification"/><default-response url="."/></transition>

<transition name="createProductOtherIdentification"><parameter name="idValue" required="true"/>
<service-call name="create#mantle.product.ProductOtherIdentification"/>
<default-response url="."/></transition>
<transition name="updateProductOtherIdentification"><service-call name="update#mantle.product.ProductOtherIdentification"/>
<default-response url="."/></transition>
<transition name="deleteProductOtherIdentification">
<parameter name="productIdTypeEnumId"/>
<service-call name="delete#mantle.product.ProductOtherIdentification"/><default-response url="."/></transition>
<transition name="generateUrlSlugOtherIdent">
<service-call name="mantle.product.StoreServices.generate#UrlSlugFromProductName"/>
<default-response url="."/></transition>

<transition name="createProductFeature"><service-call name="mantle.product.ProductServices.create#ProductFeature"/>
<default-response url="."/></transition>
<transition name="applyProductFeatures"><service-call name="mantle.product.ProductServices.apply#ProductFeatures"/>
Expand Down Expand Up @@ -84,10 +96,22 @@ along with this software (see the LICENSE.md file). If not, see
<entity-find-one entity-name="mantle.product.Product" value-field="product" cache="false"/>
<if condition="product == null"><return error="true" message="Product not found with ID ${productId}"/></if>

<entity-find entity-name="moqui.basic.Enumeration" limit="200" cache="true" list="productIdentificationTypeList">
<econdition field-name="enumTypeId" value="ProductIdentificationType"/>
<econdition field-name="enumId" operator="not-in" from="productIdTypeEnumIds" ignore-if-empty="true"/>
<order-by field-name="description"/></entity-find>
<entity-find entity-name="mantle.product.ProductIdentification" list="productIdentificationList">
<econdition field-name="productId"/></entity-find>
<set field="productIdTypeEnumIds" from="productIdentificationList*.productIdTypeEnumId"/>

<entity-find entity-name="mantle.product.store.ProductStore" limit="200" cache="true" list="productStoreList">
<order-by field-name="storeName"/></entity-find>
<entity-find entity-name="mantle.marketing.segment.MarketSegment" limit="200" cache="true" list="marketSegmentList">
<order-by field-name="description"/></entity-find>
<entity-find entity-name="mantle.product.ProductOtherIdentification" list="productOtherIdentificationList">
<econdition field-name="productId"/></entity-find>
<set field="productIdOtherTypeEnumIds" from="productOtherIdentificationList*.productIdTypeEnumId"/>

<set field="isEquipment" from="product.assetTypeEnumId in ['AstTpEquipment', 'AstTpRental']"/>
<set field="isInventory" from="product.assetTypeEnumId == 'AstTpInventory'"/>
</actions>
Expand Down Expand Up @@ -221,13 +245,7 @@ along with this software (see the LICENSE.md file). If not, see
<form-single name="AddIdentificationForm" transition="createProductIdentification">
<field name="productId"><default-field><hidden/></default-field></field>
<field name="productIdTypeEnumId"><default-field title="ID Type">
<drop-down><entity-options key="${enumId}" text="${description}">
<entity-find entity-name="moqui.basic.Enumeration">
<econdition field-name="enumTypeId" value="ProductIdentificationType"/>
<econdition field-name="enumId" operator="not-in" from="productIdTypeEnumIds" ignore-if-empty="true"/>
<order-by field-name="description"/>
</entity-find>
</entity-options></drop-down>
<drop-down><list-options list="productIdentificationTypeList.findAll{!productIdTypeEnumIds.contains(it.enumId)}" key="${enumId}" text="${description}"/></drop-down>
</default-field></field>
<field name="idValue"><default-field><text-line size="20"/></default-field></field>
<field name="submitButton"><default-field title="Add"><submit/></default-field></field>
Expand All @@ -245,6 +263,47 @@ along with this software (see the LICENSE.md file). If not, see
</form-list>
</box-body></container-box>

<container-box><box-header title="Other Identification"/><box-toolbar>
<form-single name="GenerateOtherIdentification" transition="generateUrlSlugOtherIdent">
<field name="productId"><default-field><hidden/></default-field></field>
<field name="productName" from="product?.productName"><default-field><hidden/></default-field></field>
<field name="submitButton"><conditional-field title="Generate Url Slug" tooltip="Generate Url Slug from the Product's Name"
condition="productOtherIdentificationList?.findAll{it.productIdTypeEnumId == 'PidtUrlSlug' }?.size() == 0">
<submit/></conditional-field></field></form-single>
<container-dialog id="AddOtherIdentificationDialog" button-text="Add Other Identification">
<form-single name="AddOtherIdentificationForm" transition="createProductOtherIdentification">
<field name="productId"><default-field><hidden/></default-field></field>
<field name="productIdTypeEnumId"><default-field title="ID Type">
<drop-down><list-options list="productIdentificationTypeList" key="${enumId}" text="${description}"/></drop-down>
</default-field></field>
<field name="productStoreId"><default-field>
<drop-down allow-empty="true"><list-options list="productStoreList" key="${productStoreId}" text="${storeName}"/></drop-down>
</default-field></field>
<field name="marketSegmentId"><default-field>
<drop-down allow-empty="true"><list-options list="marketSegmentList" key="${marketSegmentId}" text="${description}"/></drop-down>
</default-field></field>
<field name="idValue"><default-field><text-line size="20"/></default-field></field>
<field name="submitButton"><default-field title="Add"><submit/></default-field></field>
</form-single>
</container-dialog>
</box-toolbar><box-body>
<form-list name="OtherIdentificationsForm" list="productOtherIdentificationList" transition="updateProductOtherIdentification">
<field name="productId"><default-field><hidden/></default-field></field>
<field name="productIdTypeEnumId"><default-field title="ID Type">
<drop-down><list-options list="productIdentificationTypeList" key="${enumId}" text="${description}"/></drop-down></default-field>
</field>
<field name="productStoreId"><default-field>
<drop-down allow-empty="true"><list-options list="productStoreList" key="${productStoreId}" text="${storeName}"/></drop-down>
</default-field></field>
<field name="marketSegmentId"><default-field>
<drop-down allow-empty="true"><list-options list="marketSegmentList" key="${marketSegmentId}" text="${description}"/></drop-down>
</default-field></field>
<field name="idValue"><default-field><text-line size="20"/></default-field></field>
<field name="submitButton"><default-field title="Update"><submit/></default-field></field>
<field name="removeButton"><default-field title=""><link url="deleteProductOtherIdentification" icon="fa fa-trash" confirmation="Delete this ID?"/></default-field></field>
</form-list>
</box-body></container-box>

<container-box><box-header title="Features"/><box-toolbar>
<container-dialog id="NewFeatureDialog" button-text="Apply New Feature">
<form-single name="NewFeatureForm" transition="createProductFeature">
Expand Down

0 comments on commit f381cea

Please sign in to comment.