Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleTASK 1 - Create the fee config structure
Inside the new fee structure, we will create the methods that will used to form fields.
Expand
titleTASK 2 - Create a method to base the fields
the Fee config form
  • Create the fee config fields

    https://github.com/rbilabs/
    • path: intl-whitelabel-cms/schemas/fees/objectsdocuments/fee-fieldsconfig.tsx

    • We will need of the fields to:

      • Toggle;

      • Title;

      • text;

      • Combo-box;

      • Period date (start date and end date);

      • Restaurant group;

      • Fee config group;

    • Extra method:

      • Format date method;

    See:
    • path: intl-whitelabel-cms/

    tree
    • schemas/fees/

    poc
    • documents/

    IBFEC
    • fee-

    1747-fees-custom-message-3
expand
Expand
titleTASK 3 - Create the fee Fee Restaurant config form
  • Create the Fee Restaurant Config fields

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config

    fields
    • .tsx

    • path: intl-whitelabel-cms/schemas/fees/documents/fee-restaurant-config-list.tsx

    • Using the method bases create;

      • See the acceptance criteria: httpsSanity > Fee Restaurant Config

      • http://rbictg.atlassian.net/wiki/spaces/IBC/pages/4626514263/Tiered+Fees+Custom+Discount+Message#Acceptance-criteria

        • item: Sanity > Fee Config

Expand
Expand
titleTASK 4 - Disable the

...

fields after first publish
  • After the first publish we will need to disable the fields:

    • Default Config

      Image Added
    • Fee Type

      Image Added

As the Fee Config document is used in the Fee Restaurant Config document the user can change the toggle even if the document is already published. As we don’t find a way to control this we need to ensure that the user will not be able to change the value of the toggle after the first publish.

Sanity doc:

https://dev-plk-es-whitelabel-cms.rbi.tools/desk/marketingContent;features;featureFee;feesConfig

image-20240429-175740.pngImage Modified

To achieve that, we can:

  1. Create a custom publish action (https://www.sanity.io/docs/document-actions)

    1. This action will be responsible for setting true on the new custom field isPublished (see below for more details) - https://www.sanity.io/docs/document-actions#362c883e4421 and https://www.sanity.io/docs/http-patches#6TPENSW3

  2. Condition this new action to be only available for the Fee Config document (without affecting the other documents)

  3. Create a new custom field in the Fee Config option to know if the document is already published or not (the name can be isPublished, for example)

    1. Add the hidden to this new field, as the user doesn’t need to see it. This field will only be used to control if the toggle is read-only or not (aka disabled)

  4. Add the readOnly property to the Default Config toggle using the new isPublished prop

...

Demonstration

...

WhiteLabel

TASK 1 - [intl-whitelabel-cms] - Create Feature Fee page on sanity
Expand
title

Create a new page to configure the Fee discount message

  1. See

the POC code
  1. : https://github.com/rbilabs/intl-whitelabel-cms/tree/

feat
  1. poc/IBFEC-1747-fees-custom-message-3

Demonstration

Default Config toggle read only after first publish.webm

WhiteLabel

Expand
titleTASK 2 1 - [intl-whitelabel-app] - Create hook a new query to get the sanity infosSanity values
  • Create a new Fragment and change the RestaurantGroup queries

    image-20240415-092445.pngImage Removed

    query to get the Sanity values;

  • Run apollo generate to create the sanity graphql method;Create a

Fee values
  • We can use the: frontend/src/hooks/use-restaurant-groups/use-restaurant-groups.ts

  • Or we can create a new hook using the useResturantGroupByGroupIdQuery query also used in the hook above
    Expand
    titleTASK 1 - [intl-whitelabel-app] - Create hook to get the
    sanity infos
    • Create a hook to get the Fee config values;

    Expand
    titleTASK 3 - [intl-whitelabel-app] - Create a method to validate the fee config values
    • Create a feature flag to use the new fields or validation (if using the existing hook);Create a method to validate the fee values described in the Whitelabel Acceptance Criteria:

    Expand
    titleTASK 4 - [intl-whitelabel-app] - Add the promotion description on table fee modal
    • Add the Fee discount message on the table fee modal

      • The message needs to use the method created to validate he the fee values

    Screenshots

    N/A

    Unit Test

    ...