{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "receipts",
        "name": "Receipts",
        "version": 1,
        "schema": "tailapps/v0",
        "exported_at": 1796047761,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "5fa0ba1c797246a4ae641568bb2786c95e1986eb91948ddd2aa3e4e54f59d723"
        },
        "signature": "ex9FjJ9kJ32Bio14CkmIICjFfKOlVlSOxyAsjw4mpDZpCPzNLeZOqYh2WSDVJ2GovFaRJpKXGIHNhnD6u2o1Ag==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "receipts",
        "name": "Receipts",
        "description": "Add an amount and a note, snap the receipt, and see the total. The photos are kept with the card, and with Sync to My Devices on they follow it to your other devices, end-to-end encrypted.",
        "icon": "doc.text.viewfinder",
        "version": 1,
        "permissions": [
            "camera"
        ],
        "state": {
            "receipts": {
                "type": "list",
                "default": [],
                "sync": true
            },
            "amount": {
                "type": "number",
                "default": 0
            },
            "note": {
                "type": "text",
                "default": ""
            }
        },
        "actions": {
            "add": {
                "steps": [
                    {
                        "camera.take": [],
                        "as": "photo"
                    },
                    {
                        "files.keep": "$photo.path",
                        "as": "kept"
                    },
                    {
                        "push": {
                            "receipts": {
                                "id": "$kept.id",
                                "photo": "$kept",
                                "amount": "$amount",
                                "note": "$note",
                                "at": "$now"
                            }
                        }
                    },
                    {
                        "set": {
                            "amount": 0,
                            "note": ""
                        }
                    }
                ]
            },
            "remove": {
                "steps": [
                    {
                        "remove": {
                            "receipts": {
                                "match": {
                                    "id": "$args.item.id"
                                }
                            }
                        }
                    }
                ]
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "row": [
                                {
                                    "stat": "$receipts | sum:'amount' | currency:'GBP':'full'",
                                    "label": "Total"
                                },
                                {
                                    "spacer": true
                                },
                                {
                                    "stat": "$receipts | count",
                                    "label": "Receipts"
                                }
                            ],
                            "align": "start"
                        },
                        {
                            "row": [
                                {
                                    "field": "",
                                    "type": "number",
                                    "bind": "$amount",
                                    "placeholder": "Amount"
                                },
                                {
                                    "field": "",
                                    "type": "text",
                                    "bind": "$note",
                                    "placeholder": "Note"
                                }
                            ]
                        },
                        {
                            "button": "Snap Receipt",
                            "on": "add",
                            "style": "primary",
                            "icon": "camera",
                            "grow": true,
                            "disabled": "$running.add"
                        },
                        {
                            "list": "$receipts",
                            "empty": "No receipts yet. Type the amount and a note, then snap the receipt.",
                            "swipe": {
                                "trailing": [
                                    {
                                        "label": "Delete",
                                        "icon": "trash",
                                        "style": "destructive",
                                        "on": "remove"
                                    }
                                ]
                            },
                            "item": {
                                "row": [
                                    {
                                        "image": "$item.photo",
                                        "height": "s",
                                        "fit": "fill",
                                        "preview": true,
                                        "alt": "Receipt"
                                    },
                                    {
                                        "column": [
                                            {
                                                "text": "$item.amount | currency:'GBP':'full'",
                                                "emphasis": "strong"
                                            },
                                            {
                                                "text": "{$item.note | default:'No note'} \u00b7 {$item.at | date}",
                                                "size": "s",
                                                "emphasis": "subtle"
                                            }
                                        ],
                                        "gap": "xs",
                                        "grow": true
                                    }
                                ]
                            }
                        }
                    ],
                    "gap": "m"
                }
            }
        ],
        "views": {
            "menubar": {
                "icon": "doc.text.viewfinder",
                "label": "{$receipts | sum:'amount' | currency:'GBP'}",
                "in_menu": "card"
            }
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"receipts\",\n  \"name\": \"Receipts\",\n  \"description\": \"Add an amount and a note, snap the receipt, and see the total. The photos are kept with the card, and with Sync to My Devices on they follow it to your other devices, end-to-end encrypted.\",\n  \"icon\": \"doc.text.viewfinder\",\n  \"version\": 1,\n  \"permissions\": [\"camera\"],\n  \"state\": {\n    \"receipts\": { \"type\": \"list\", \"default\": [], \"sync\": true },\n    \"amount\": { \"type\": \"number\", \"default\": 0 },\n    \"note\": { \"type\": \"text\", \"default\": \"\" }\n  },\n  \"actions\": {\n    \"add\": {\n      \"steps\": [\n        { \"camera.take\": {}, \"as\": \"photo\" },\n        { \"files.keep\": \"$photo.path\", \"as\": \"kept\" },\n        {\n          \"push\": {\n            \"receipts\": { \"id\": \"$kept.id\", \"photo\": \"$kept\", \"amount\": \"$amount\", \"note\": \"$note\", \"at\": \"$now\" }\n          }\n        },\n        { \"set\": { \"amount\": 0, \"note\": \"\" } }\n      ]\n    },\n    \"remove\": {\n      \"steps\": [\n        { \"remove\": { \"receipts\": { \"match\": { \"id\": \"$args.item.id\" } } } }\n      ]\n    }\n  },\n  \"cards\": [\n    {\n      \"id\": \"main\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"row\": [\n              { \"stat\": \"$receipts | sum:'amount' | currency:'GBP':'full'\", \"label\": \"Total\" },\n              { \"spacer\": true },\n              { \"stat\": \"$receipts | count\", \"label\": \"Receipts\" }\n            ],\n            \"align\": \"start\"\n          },\n          {\n            \"row\": [\n              { \"field\": \"\", \"type\": \"number\", \"bind\": \"$amount\", \"placeholder\": \"Amount\" },\n              { \"field\": \"\", \"type\": \"text\", \"bind\": \"$note\", \"placeholder\": \"Note\" }\n            ]\n          },\n          { \"button\": \"Snap Receipt\", \"on\": \"add\", \"style\": \"primary\", \"icon\": \"camera\", \"grow\": true, \"disabled\": \"$running.add\" },\n          {\n            \"list\": \"$receipts\",\n            \"empty\": \"No receipts yet. Type the amount and a note, then snap the receipt.\",\n            \"swipe\": {\n              \"trailing\": [{ \"label\": \"Delete\", \"icon\": \"trash\", \"style\": \"destructive\", \"on\": \"remove\" }]\n            },\n            \"item\": {\n              \"row\": [\n                { \"image\": \"$item.photo\", \"height\": \"s\", \"fit\": \"fill\", \"preview\": true, \"alt\": \"Receipt\" },\n                {\n                  \"column\": [\n                    { \"text\": \"$item.amount | currency:'GBP':'full'\", \"emphasis\": \"strong\" },\n                    { \"text\": \"{$item.note | default:'No note'} \u00b7 {$item.at | date}\", \"size\": \"s\", \"emphasis\": \"subtle\" }\n                  ],\n                  \"gap\": \"xs\",\n                  \"grow\": true\n                }\n              ]\n            }\n          }\n        ],\n        \"gap\": \"m\"\n      }\n    }\n  ],\n  \"views\": {\n    \"menubar\": {\n      \"icon\": \"doc.text.viewfinder\",\n      \"label\": \"{$receipts | sum:'amount' | currency:'GBP'}\",\n      \"in_menu\": \"card\"\n    }\n  }\n}\n",
    "files": []
}