e-picsa / picsa-apps

Monorepo for building tools to support E-PICSA Apps
https://picsa.app
GNU General Public License v3.0
5 stars 1 forks source link

feat(budget): detailed summary #205

Closed chrismclarke closed 5 months ago

chrismclarke commented 6 months ago

Is your feature request related to a problem? Please describe. The budget tool list page shows saved budgets with limited information (crop and name).

image

It would be good to include a more detailed summary, namely:

Describe the solution you'd like A clear and concise description of what you want to happen.

Additional context If you want an example budget to look at import budget with code 4KB7

Ideally this should be a single budget-summary component that could also be displayed on other pages if required (reusable)

Averages will need to be calculated by iterating over budget data, e.g. data below (will need to identify total values for different properties)

{
    "_modified": "2023-12-14T16:02:23.677Z",
    "_key": "wR3PMKtevXCJ5q5p76YD_fWvBAq88WNXURQvc0Zuh_bNuYFL0M1c2dPICjmqz8",
    "_appVersion": "3.7.1",
    "_created": "2022-09-28T09:21:21.771Z",
    "meta": {
        "monthStart": 12,
        "title": "Maize production ",
        "valueScale": 1,
        "enterprise": {
            "groupings": [
                "crop"
            ],
            "label": "maize",
            "type": "enterprise",
            "_modified": "2022-09-28T09:19:47.368Z",
            "id": "maize",
            "_created": "2019-09-30T00:00:00.000Z",
            "imgType": "svg",
            "_key": "enterprise_maize"
        },
        "lengthTotal": 6,
        "lengthScale": "months",
        "description": "The production is on a ripped 1 acre field.Manure is used to fertilize the crop"
    },
    "apiVersion": 5,
    "data": [
        {
            "outputs": [],
            "activities": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "ploughing",
                    "id": "ploughing",
                    "type": "activities",
                    "_key": "activities_ploughing",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "land-clearing",
                    "label": "land clearing",
                    "_key": "activities_land-clearing",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "id": "compost-manure-making",
                    "label": "compost manure making",
                    "_key": "activities_compost-manure-making",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "livestock"
                    ],
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "dipping",
                    "label": "dipping",
                    "_key": "activities_dipping",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.367Z",
                    "imgType": "svg"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "sowing",
                    "label": "sowing",
                    "_key": "activities_sowing",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                }
            ],
            "inputs": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": 400,
                        "quantity": 4,
                        "cost": 100
                    },
                    "id": "manure-sacks",
                    "label": "manure sacks",
                    "type": "inputs",
                    "_key": "inputs_manure-sacks",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": 100,
                        "quantity": 1,
                        "cost": 100
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "chemicals",
                    "id": "chemicals",
                    "_key": "inputs_chemicals",
                    "type": "inputs",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "svg"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "label": "ox cart",
                    "id": "ox-cart",
                    "type": "inputs",
                    "_key": "inputs_ox-cart",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "svg"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "protective-equipment",
                    "label": "protective equipment",
                    "_key": "inputs_protective-equipment",
                    "type": "inputs",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": 450,
                        "quantity": 1,
                        "cost": 450
                    },
                    "label": "seeds",
                    "id": "seeds",
                    "type": "inputs",
                    "_key": "inputs_seeds",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                }
            ],
            "produceConsumed": [],
            "familyLabour": [
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "id": "adultMale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "cost": 0,
                        "quantity": 3
                    },
                    "id": "adultFemale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultMale",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "id": "adultFemale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                }
            ]
        },
        {
            "outputs": [],
            "activities": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "weeding",
                    "label": "weeding",
                    "_key": "activities_weeding",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2022-10-19T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "label": "apply pesticide",
                    "id": "apply-pesticide",
                    "type": "activities",
                    "_key": "activities_apply-pesticide",
                    "_modified": "2022-10-19T20:11:00.601Z",
                    "imgType": "svg"
                }
            ],
            "inputs": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": 100,
                        "cost": 100,
                        "quantity": 1
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "chemicals",
                    "id": "chemicals",
                    "_key": "inputs_chemicals",
                    "type": "inputs",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "svg"
                },
                {
                    "groupings": [
                        "crop",
                        "livestock"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": 300,
                        "quantity": 2,
                        "cost": 150
                    },
                    "label": "labour - paid",
                    "id": "labour---paid",
                    "type": "inputs",
                    "_key": "inputs_labour---paid",
                    "_modified": "2022-09-28T09:19:47.370Z",
                    "imgType": "png"
                }
            ],
            "produceConsumed": [],
            "familyLabour": [
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "cost": 0,
                        "quantity": 4
                    },
                    "id": "adultMale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "quantity": null,
                        "cost": 0
                    },
                    "id": "adultFemale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": null,
                        "cost": 0
                    },
                    "id": "adultMale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "quantity": null,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultFemale",
                    "type": "familyLabour",
                    "imgType": "svg"
                }
            ]
        },
        {
            "outputs": [],
            "activities": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "_created": "2022-10-19T00:00:00.000Z",
                    "id": "apply-pesticide",
                    "label": "apply pesticide",
                    "_key": "activities_apply-pesticide",
                    "type": "activities",
                    "_modified": "2022-10-19T20:11:00.601Z",
                    "imgType": "svg"
                }
            ],
            "inputs": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": 100,
                        "quantity": 1,
                        "cost": 100
                    },
                    "label": "chemicals",
                    "id": "chemicals",
                    "_key": "inputs_chemicals",
                    "type": "inputs",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "svg"
                }
            ],
            "produceConsumed": [],
            "familyLabour": []
        },
        {
            "outputs": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": 600,
                        "cost": 3,
                        "quantity": 200
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "crop",
                    "label": "crop",
                    "type": "outputs",
                    "_key": "outputs_crop",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                }
            ],
            "inputs": [],
            "activities": [
                {
                    "customMeta": {
                        "dateCreated": "2022-09-28T09:46:14.498Z",
                        "createdBy": "",
                        "imgData": "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" style=\"shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd\"\n    viewBox=\"0 0 100 100\">\n      <g id=\"UrTavla\">\n        <circle style=\"fill:url(#toning);stroke:#adadad;stroke-width:3;stroke-miterlimit:10;\" cx=\"50\" cy=\"50\" r=\"40\">\n        </circle>\n        <text font-family=\"Super Sans\" letter-spacing=\"2\" x=\"50%\" y=\"50%\" text-anchor=\"middle\" stroke=\"#adadad\" fill=\"#adadad\" font-size=\"35\" stroke-width=\"2px\" dy=\".3em\">\n        F.m\n        </text>\n      </g>\n    </svg>\n    "
                    },
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "id": "field-monitoring",
                    "label": "Field monitoring",
                    "type": "activities"
                }
            ],
            "produceConsumed": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": 200,
                        "cost": null
                    },
                    "id": "crop",
                    "label": "crop",
                    "_key": "outputs_crop",
                    "type": "outputs",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                }
            ],
            "familyLabour": [
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 1,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultMale",
                    "type": "familyLabour",
                    "imgType": "svg"
                }
            ]
        },
        {
            "outputs": [],
            "inputs": [],
            "activities": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "label": "harvesting",
                    "id": "harvesting",
                    "type": "activities",
                    "_key": "activities_harvesting",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                }
            ],
            "produceConsumed": [],
            "familyLabour": [
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultMale",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "cost": 0,
                        "quantity": 3
                    },
                    "label": "family member",
                    "id": "adultFemale",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultMale",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "quantity": 3,
                        "cost": 0
                    },
                    "id": "adultFemale",
                    "label": "family member",
                    "type": "familyLabour",
                    "imgType": "svg"
                }
            ]
        },
        {
            "outputs": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": 6000,
                        "cost": 300,
                        "quantity": 20
                    },
                    "id": "crop",
                    "label": "crop",
                    "type": "outputs",
                    "_key": "outputs_crop",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                }
            ],
            "activities": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "id": "shelling",
                    "label": "shelling",
                    "_key": "activities_shelling",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "label": "threshing",
                    "id": "threshing",
                    "_key": "activities_threshing",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "cost": null,
                        "quantity": null
                    },
                    "id": "bagging",
                    "label": "bagging",
                    "type": "activities",
                    "_key": "activities_bagging",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "id": "storage",
                    "label": "storage",
                    "_key": "activities_storage",
                    "type": "activities",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop",
                        "livestock"
                    ],
                    "values": {
                        "total": null,
                        "quantity": null,
                        "cost": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "marketing and selling",
                    "id": "marketing-and-selling",
                    "type": "activities",
                    "_key": "activities_marketing-and-selling",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "png"
                }
            ],
            "inputs": [
                {
                    "groupings": [
                        "crop",
                        "livestock"
                    ],
                    "values": {
                        "total": 200,
                        "cost": 50,
                        "quantity": 4
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "labour - paid",
                    "id": "labour---paid",
                    "type": "inputs",
                    "_key": "inputs_labour---paid",
                    "_modified": "2022-09-28T09:19:47.370Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "livestock",
                        "crops"
                    ],
                    "values": {
                        "total": 150,
                        "quantity": 30,
                        "cost": 5
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "id": "bags",
                    "label": "bags",
                    "_key": "inputs_bags",
                    "type": "inputs",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                },
                {
                    "groupings": [
                        "crop"
                    ],
                    "_created": "2019-09-30T00:00:00.000Z",
                    "values": {
                        "total": null,
                        "quantity": 1,
                        "cost": 0
                    },
                    "label": "ox cart",
                    "id": "ox-cart",
                    "type": "inputs",
                    "_key": "inputs_ox-cart",
                    "_modified": "2022-09-28T09:19:47.369Z",
                    "imgType": "svg"
                }
            ],
            "produceConsumed": [
                {
                    "groupings": [
                        "crop"
                    ],
                    "values": {
                        "total": null,
                        "quantity": 10,
                        "cost": null
                    },
                    "_created": "2019-09-30T00:00:00.000Z",
                    "label": "crop",
                    "id": "crop",
                    "type": "outputs",
                    "_key": "outputs_crop",
                    "_modified": "2022-09-28T09:19:47.368Z",
                    "imgType": "png"
                }
            ],
            "familyLabour": [
                {
                    "imgId": "family-labour_adultMale",
                    "values": {
                        "total": 0,
                        "quantity": 1,
                        "cost": 0
                    },
                    "label": "family member",
                    "id": "adultMale",
                    "type": "familyLabour",
                    "imgType": "svg"
                },
                {
                    "imgId": "family-labour_adultFemale",
                    "values": {
                        "total": 0,
                        "cost": 0,
                        "quantity": 1
                    },
                    "label": "family member",
                    "id": "adultFemale",
                    "type": "familyLabour",
                    "imgType": "svg"
                }
            ]
        }
    ],
    "shareCode": "4KB7"
}