JSFiddle - React, Tailwind, and code Playground

by mreis1

JavaScript

//userPicks propertie identifies the user choices on tarif and equivalent when applied

var sent_json = {
    "idClient": 000000000,
    "print": true, // print after finish??
    "payment_list": [
        {
            "idTypePayment": 0,
            "montant": 25
        },
        {
            "idTypePayment": 0,
            "montant": 10
        }
    ],
    "shopping_cart": [
        //no equivalent article
        {
            "id": 332821270,
            "quantity": 1,
            "userPicks": { 
                "tarif": {
                    "id": 332821274
                },
                "equivalent": {} //empty object
            }
        },
        //equivalent
        {
            "id": 332821270,
            "quantity": 1,
            "userPicks": {
                "tarif": {
                    "id": 332821274
                },
                "equivalent": {
                    "id": 332821260
                }
            }
        },
        //pack
        {
            "pid": 332821263,
            "idGroupe": 3001076,
            "quantity": 2,
            "userPicks": {
                "composants": [
                    {
                        //article with equivalent
                        "id": 332821270,
                        "idGroupe": 3001076,
                        "userPicks": {
                            "equivalent": {
                                "id": 332821252,
                                "idGroupe": 3001076
                            }
                        }
                    },
                    {
                       .... other composants
                    }
                ],
                "tarif": {
                    "id": 332821267
                }
            }
        },
        
         //regroupment
        {
            "pid": 3328212123,
            "idGroupe": 3001076,
            "quantity": 2,
            "composant": [
                {
                    "id": 3002208,
  ...