JSFiddle - React, Tailwind, and code Playground

by dougiei

JavaScript

const utilsRelRec = {

    assemble_RelRec_Input_Payload: function (src_entity, tgt_entity, src_uuid, tgt_uuid, required_params) {
        var final_rel_rec_payload = {};

        var relInfoKey = src_entity + tgt_entity + "RelInfo";

        final_rel_rec_payload[relInfoKey] = {};

        final_rel_rec_payload[relInfoKey][src_entity + "Uuid"] = src_uuid;
        final_rel_rec_payload[relInfoKey][tgt_entity + "Uuid"] = tgt_uuid;

        Object.keys(required_params).forEach(function (key) {
            final_rel_rec_payload[relInfoKey][key] = required_params[key];
        });

        return final_rel_rec_payload;
    },
    assemble_Company_RelRec_Input_Payload: function (tgt_entity, config_id, org_company_role, company_uuid, product_uuid) {
        var final_company_rel_rec_payload = {};

        var src_entity = "Company";

        var relInfoKey = src_entity + tgt_entity + "RelInfo";
        final_company_rel_rec_payload[relInfoKey] = {};

        final_company_rel_rec_payload["ConfigId"] = config_id;

        final_company_rel_rec_payload[relInfoKey]["OrgCompanyRole"] = org_company_role;

        var src_ref = src_entity + "Ref";
        final_company_rel_rec_payload[relInfoKey][src_ref] = {};

        var tgt_ref = tgt_entity + "Ref";
        final_company_rel_rec_payload[relInfoKey][tgt_ref] = {};

        var src_keys = src_entity + "Keys"
        final_company_rel_rec_payload[relInfoKey][src_ref][src_keys] = {};

        var tgt_keys = tgt_entity + "Keys"
        final_company_rel_rec_payload[relInfoKey][tgt_ref][tgt_keys] = {};

        final_company_rel_rec_payload[relInfoKey][src_ref][src_keys][src_entity + "Uuid"] = company_uuid;

        final_company_rel_rec_payload[relInfoKey][tgt_ref][tgt_keys][tgt_entity + "Uuid"] = product_uuid;

        return final_company_rel_rec_payload;
    }

};

const assembleNamedRelRec = {

    product2productcomp: function (src_uuid, tgt_uuid, required_params) {

        return...