-- App 20 Seed Script
-- Generated from local DB


-- Workflow
INSERT INTO tbl_appconfig_workflows (id, workflow_uid, version, app_id, content) VALUES (20109, 'wf_p2p_invoice_demo', '1', 20, '{"name": "P2P Invoice Validation", "states": [{"uid": "p2p-state-invoice-submitted", "name": "Invoice Submitted", "type": "STANDARD", "allowed_activities": ["p2p-act-request-clarification", "p2p-act-submit-recommendation"]}, {"uid": "p2p-state-ai-analysis", "name": "AI Analysis", "type": "STANDARD", "allowed_activities": ["p2p-act-request-clarification", "p2p-act-submit-recommendation"]}, {"uid": "p2p-state-awaiting-clarification", "name": "Awaiting Clarification", "type": "STANDARD", "allowed_activities": ["p2p-act-provide-clarification"]}, {"uid": "p2p-state-finance-review", "name": "Finance Review", "type": "STANDARD", "allowed_activities": ["p2p-act-approve-payment", "p2p-act-reject-payment", "p2p-act-hold-payment"]}, {"uid": "p2p-state-approved", "name": "Approved", "type": "END", "allowed_activities": []}, {"uid": "p2p-state-rejected", "name": "Rejected", "type": "END", "allowed_activities": []}, {"uid": "p2p-state-on-hold", "name": "On Hold", "type": "END", "allowed_activities": []}], "version": 1, "sg_rules": [], "activities": [{"uid": "p2p-act-submit-invoice", "name": "Submit Invoice", "type": "INIT"}, {"uid": "p2p-act-analyze-invoice", "name": "Analyze Invoice", "type": "NORMAL", "ai_confidence_threshold": 0.5}, {"uid": "p2p-act-request-clarification", "name": "Request Clarification", "type": "NORMAL"}, {"uid": "p2p-act-provide-clarification", "name": "Provide Clarification", "type": "NORMAL"}, {"uid": "p2p-act-submit-recommendation", "name": "Submit Recommendation", "type": "NORMAL"}, {"uid": "p2p-act-approve-payment", "name": "Approve Payment", "type": "NORMAL"}, {"uid": "p2p-act-reject-payment", "name": "Reject Payment", "type": "NORMAL"}, {"uid": "p2p-act-hold-payment", "name": "Hold Payment", "type": "NORMAL"}], "stage_gates": [], "transitions": [{"to_state_id": "p2p-state-invoice-submitted", "from_state_id": "", "by_activity_id": "p2p-act-submit-invoice", "transition_type": "INIT_TO_STATE"}, {"to_state_id": "p2p-state-awaiting-clarification", "from_state_id": "p2p-state-invoice-submitted", "by_activity_id": "p2p-act-request-clarification", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-finance-review", "from_state_id": "p2p-state-invoice-submitted", "by_activity_id": "p2p-act-submit-recommendation", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-awaiting-clarification", "from_state_id": "p2p-state-ai-analysis", "by_activity_id": "p2p-act-request-clarification", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-finance-review", "from_state_id": "p2p-state-ai-analysis", "by_activity_id": "p2p-act-submit-recommendation", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-ai-analysis", "from_state_id": "p2p-state-awaiting-clarification", "by_activity_id": "p2p-act-provide-clarification", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-approved", "from_state_id": "p2p-state-finance-review", "by_activity_id": "p2p-act-approve-payment", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-rejected", "from_state_id": "p2p-state-finance-review", "by_activity_id": "p2p-act-reject-payment", "transition_type": "TO_STATE"}, {"to_state_id": "p2p-state-on-hold", "from_state_id": "p2p-state-finance-review", "by_activity_id": "p2p-act-hold-payment", "transition_type": "TO_STATE"}], "workflow_id": "wf_p2p_invoice_demo", "activity_prefills": [], "activity_triggers": [{"nodes": [{"id": "a0a0a0a0-0000-4000-8000-000000093011", "name": "Start", "type": "start", "edges": [{"target": "a0a0a0a0-0000-4000-8000-000000093012", "source_handle": "output"}], "config": {}, "ui_config": null}, {"id": "a0a0a0a0-0000-4000-8000-000000093012", "name": "AI Employee", "type": "aiEmployee", "edges": [{"target": "a0a0a0a0-0000-4000-8000-000000093013", "source_handle": "output"}], "config": {"ai_user_id": "29100"}, "ui_config": null}, {"id": "a0a0a0a0-0000-4000-8000-000000093013", "name": "Complete", "type": "response", "edges": [], "config": {"message": "AI Employee task dispatched", "success": true, "status_code": 200}, "ui_config": null}], "trigger_uid": "trigger_p2p_submit", "activity_uid": "p2p-act-submit-invoice", "trigger_config": {}}, {"nodes": [{"id": "a0a0a0a0-0000-4000-8000-000000093041", "name": "Start", "type": "start", "edges": [{"target": "a0a0a0a0-0000-4000-8000-000000093042", "source_handle": "output"}], "config": {}, "ui_config": null}, {"id": "a0a0a0a0-0000-4000-8000-000000093042", "name": "AI Employee", "type": "aiEmployee", "edges": [{"target": "a0a0a0a0-0000-4000-8000-000000093043", "source_handle": "output"}], "config": {"ai_user_id": "29100"}, "ui_config": null}, {"id": "a0a0a0a0-0000-4000-8000-000000093043", "name": "Complete", "type": "response", "edges": [], "config": {"message": "AI Employee task dispatched", "success": true, "status_code": 200}, "ui_config": null}], "trigger_uid": "trigger_p2p_clarify", "activity_uid": "p2p-act-provide-clarification", "trigger_config": {}}], "activity_data_fields": [{"data_fields": [{"id": "approved_amount", "uid": "p2p-field-9423", "name": "Approved Amount", "type": "local", "data_type": "number", "mandatory": true}, {"id": "reviewer_notes", "uid": "p2p-field-9424", "name": "Reviewer Notes", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-approve-payment", "activity_name": "Approve Payment"}, {"data_fields": [{"id": "rejection_reason", "uid": "p2p-field-9425", "name": "Rejection Reason", "type": "local", "data_type": "text", "mandatory": true}, {"id": "reviewer_notes", "uid": "p2p-field-9426", "name": "Reviewer Notes", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-reject-payment", "activity_name": "Reject Payment"}, {"data_fields": [{"id": "hold_reason", "uid": "p2p-field-9427", "name": "Hold Reason", "type": "local", "data_type": "text", "mandatory": true}, {"id": "reviewer_notes", "uid": "p2p-field-9428", "name": "Reviewer Notes", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-hold-payment", "activity_name": "Hold Payment"}, {"data_fields": [{"id": "vendor_id", "uid": "p2p-field-9401", "name": "Vendor ID", "type": "local", "data_type": "text", "mandatory": true}, {"id": "vendor_name", "uid": "p2p-field-9402", "name": "Vendor Name", "type": "local", "data_type": "text", "mandatory": true}, {"id": "invoice_number", "uid": "p2p-field-9403", "name": "Invoice Number", "type": "local", "data_type": "text", "mandatory": true}, {"id": "invoice_date", "uid": "p2p-field-9404", "name": "Invoice Date", "type": "local", "data_type": "date", "mandatory": true}, {"id": "po_number", "uid": "p2p-field-9405", "name": "PO Number", "type": "local", "data_type": "text", "mandatory": true}, {"id": "currency", "uid": "p2p-field-9406", "name": "Currency", "type": "local", "data_type": "text", "mandatory": false}, {"id": "total_amount", "uid": "p2p-field-9407", "name": "Total Amount", "type": "local", "data_type": "number", "mandatory": true}, {"id": "tax_amount", "uid": "p2p-field-9408", "name": "Tax Amount", "type": "local", "data_type": "number", "mandatory": false}, {"id": "payment_terms", "uid": "p2p-field-9409", "name": "Payment Terms", "type": "local", "data_type": "text", "mandatory": false}, {"id": "notes", "uid": "p2p-field-9410", "name": "Notes", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-submit-invoice", "activity_name": "Submit Invoice"}, {"data_fields": [{"id": "target_department", "uid": "p2p-field-9411", "name": "Target Department", "type": "local", "data_type": "text", "mandatory": true}, {"id": "clarification_question", "uid": "p2p-field-9412", "name": "Question", "type": "local", "data_type": "text", "mandatory": true}, {"id": "clarification_context", "uid": "p2p-field-9413", "name": "Context", "type": "local", "data_type": "text", "mandatory": false}, {"id": "analysis_so_far", "uid": "p2p-field-9414", "name": "Analysis So Far", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-request-clarification", "activity_name": "Request Clarification"}, {"data_fields": [{"id": "response_text", "uid": "p2p-field-9415", "name": "Response", "type": "local", "data_type": "text", "mandatory": true}, {"id": "confirmed_quantity", "uid": "p2p-field-9416", "name": "Confirmed Quantity", "type": "local", "data_type": "number", "mandatory": false}, {"id": "response_notes", "uid": "p2p-field-9417", "name": "Additional Notes", "type": "local", "data_type": "text", "mandatory": false}], "activity_uid": "p2p-act-provide-clarification", "activity_name": "Provide Clarification"}, {"data_fields": [{"id": "recommendation", "uid": "p2p-field-9418", "name": "Recommendation", "type": "local", "data_type": "text", "mandatory": true}, {"id": "recommended_amount", "uid": "p2p-field-9419", "name": "Recommended Payment Amount", "type": "local", "data_type": "number", "mandatory": false}, {"id": "match_summary", "uid": "p2p-field-9420", "name": "Match Summary", "type": "local", "data_type": "text", "mandatory": false}, {"id": "ai_reasoning", "uid": "p2p-field-9421", "name": "AI Reasoning", "type": "local", "data_type": "text", "mandatory": false}, {"id": "ai_confidence", "uid": "p2p-field-9422", "name": "AI Confidence", "type": "local", "data_type": "number", "mandatory": false}], "activity_uid": "p2p-act-submit-recommendation", "activity_name": "Submit Recommendation"}], "activity_permissions": [{"id": "p2p-act-submit-invoice", "allowed_roles": [{"role": "p2p_vendor", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-analyze-invoice", "allowed_roles": [{"role": "p2p_ai_finance", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-request-clarification", "allowed_roles": [{"role": "p2p_ai_finance", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-provide-clarification", "allowed_roles": [{"role": "p2p_warehouse", "positions": ""}, {"role": "p2p_procurement", "positions": ""}, {"role": "p2p_ap_team", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-submit-recommendation", "allowed_roles": [{"role": "p2p_ai_finance", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-approve-payment", "allowed_roles": [{"role": "p2p_finance_reviewer", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-reject-payment", "allowed_roles": [{"role": "p2p_finance_reviewer", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}, {"id": "p2p-act-hold-payment", "allowed_roles": [{"role": "p2p_finance_reviewer", "positions": ""}], "allowed_groups": [], "dynamic_rbac_allowed": false, "only_roles_positions": false}], "workflow_data_fields": null}'::jsonb) ON CONFLICT (id) DO UPDATE SET content = EXCLUDED.content;

-- Record Views
INSERT INTO tbl_appconfig_recordview (id, rv_uid, rv_description, workflow_uid, app_id, config) VALUES (20034, 'p2p-rv-all-invoices', 'All invoice instances across all states', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "system-global", "data_type": "text", "field_key": "current_state_name", "field_uid": "", "is_filter": true, "is_search": false, "activity_id": "SYSTEM", "output_label": "Current State"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9401", "is_filter": true, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "text", "field_key": "po_number", "field_uid": "p2p-field-9405", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "PO #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Amount"}, {"type": "system-global", "data_type": "datetime", "field_key": "created_at", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Created"}]}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
INSERT INTO tbl_appconfig_recordview (id, rv_uid, rv_description, workflow_uid, app_id, config) VALUES (20035, 'p2p-rv-pending-clarifications', 'Invoices awaiting department clarification', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9402", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Amount"}, {"type": "local", "data_type": "text", "field_key": "target_department", "field_uid": "p2p-field-9411", "is_filter": true, "is_search": false, "activity_id": "p2p-act-request-clarification", "output_label": "Department"}, {"type": "system-global", "data_type": "datetime", "field_key": "created_at", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Created"}], "prefilters": {"logic": "AND", "conditions": [{"value": "Awaiting Clarification", "operator": "equals", "data_type": "text", "field_key": "current_state_name"}]}}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
INSERT INTO tbl_appconfig_recordview (id, rv_uid, rv_description, workflow_uid, app_id, config) VALUES (20037, 'p2p-rv-vendor-invoices', 'Vendor''s submitted invoices with status tracking', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "system-global", "data_type": "text", "field_key": "current_state_name", "field_uid": "", "is_filter": true, "is_search": false, "activity_id": "SYSTEM", "output_label": "Status"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "text", "field_key": "po_number", "field_uid": "p2p-field-9405", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "PO #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Amount"}, {"type": "system-global", "data_type": "datetime", "field_key": "created_at", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Submitted"}]}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
INSERT INTO tbl_appconfig_recordview (id, rv_uid, rv_description, workflow_uid, app_id, config) VALUES (20036, 'p2p-rv-finance-review-queue', 'Invoices ready for finance review with AI recommendations', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9402", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": true, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Amount"}, {"type": "local", "data_type": "text", "field_key": "recommendation", "field_uid": "p2p-field-9418", "is_filter": true, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "AI Recommendation"}, {"type": "local", "data_type": "number", "field_key": "recommended_amount", "field_uid": "p2p-field-9419", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "Recommended Amt"}, {"type": "system-global", "data_type": "datetime", "field_key": "created_at", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Created"}], "prefilters": {"logic": "AND", "conditions": [{"value": "Finance Review", "operator": "equals", "data_type": "text", "field_key": "current_state_name"}]}}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;

-- Detail Views
INSERT INTO tbl_appconfig_detailview (id, dv_uid, dv_description, workflow_uid, app_id, config) VALUES (20014, 'p2p-dv-clarification-detail', 'AI question and context for department response', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9402", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "text", "field_key": "po_number", "field_uid": "p2p-field-9405", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "PO #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Amount"}, {"type": "local", "data_type": "text", "field_key": "target_department", "field_uid": "p2p-field-9411", "is_filter": false, "is_search": false, "activity_id": "p2p-act-request-clarification", "output_label": "Target Department"}, {"type": "local", "data_type": "text", "field_key": "clarification_question", "field_uid": "p2p-field-9412", "is_filter": false, "is_search": false, "activity_id": "p2p-act-request-clarification", "output_label": "AI Question"}, {"type": "local", "data_type": "text", "field_key": "clarification_context", "field_uid": "p2p-field-9413", "is_filter": false, "is_search": false, "activity_id": "p2p-act-request-clarification", "output_label": "Context"}, {"type": "local", "data_type": "text", "field_key": "analysis_so_far", "field_uid": "p2p-field-9414", "is_filter": false, "is_search": false, "activity_id": "p2p-act-request-clarification", "output_label": "Analysis So Far"}]}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
INSERT INTO tbl_appconfig_detailview (id, dv_uid, dv_description, workflow_uid, app_id, config) VALUES (20015, 'p2p-dv-finance-review-detail', 'AI recommendation with full decision trail for finance reviewer', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "system-global", "data_type": "text", "field_key": "current_state_name", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Status"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9402", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice #"}, {"type": "local", "data_type": "text", "field_key": "po_number", "field_uid": "p2p-field-9405", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "PO #"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice Amount"}, {"type": "local", "data_type": "number", "field_key": "tax_amount", "field_uid": "p2p-field-9408", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Tax"}, {"type": "local", "data_type": "text", "field_key": "recommendation", "field_uid": "p2p-field-9418", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "AI Recommendation"}, {"type": "local", "data_type": "number", "field_key": "recommended_amount", "field_uid": "p2p-field-9419", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "Recommended Amount"}, {"type": "local", "data_type": "text", "field_key": "match_summary", "field_uid": "p2p-field-9420", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "Match Summary"}, {"type": "local", "data_type": "text", "field_key": "ai_reasoning", "field_uid": "p2p-field-9421", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "AI Reasoning"}, {"type": "local", "data_type": "number", "field_key": "ai_confidence", "field_uid": "p2p-field-9422", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-recommendation", "output_label": "AI Confidence"}]}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
INSERT INTO tbl_appconfig_detailview (id, dv_uid, dv_description, workflow_uid, app_id, config) VALUES (20013, 'p2p-dv-invoice-detail', 'Full invoice detail with AI analysis trail', 'wf_p2p_invoice_demo', 20, '{"fields": [{"type": "system-global", "data_type": "text", "field_key": "instance_id", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Instance ID"}, {"type": "system-global", "data_type": "text", "field_key": "current_state_name", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Status"}, {"type": "system-global", "data_type": "datetime", "field_key": "created_at", "field_uid": "", "is_filter": false, "is_search": false, "activity_id": "SYSTEM", "output_label": "Created"}, {"type": "local", "data_type": "text", "field_key": "vendor_id", "field_uid": "p2p-field-9401", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor ID"}, {"type": "local", "data_type": "text", "field_key": "vendor_name", "field_uid": "p2p-field-9402", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor Name"}, {"type": "local", "data_type": "text", "field_key": "invoice_number", "field_uid": "p2p-field-9403", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice Number"}, {"type": "local", "data_type": "date", "field_key": "invoice_date", "field_uid": "p2p-field-9404", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Invoice Date"}, {"type": "local", "data_type": "text", "field_key": "po_number", "field_uid": "p2p-field-9405", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "PO Number"}, {"type": "local", "data_type": "number", "field_key": "total_amount", "field_uid": "p2p-field-9407", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Total Amount"}, {"type": "local", "data_type": "number", "field_key": "tax_amount", "field_uid": "p2p-field-9408", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Tax Amount"}, {"type": "local", "data_type": "text", "field_key": "payment_terms", "field_uid": "p2p-field-9409", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Payment Terms"}, {"type": "local", "data_type": "text", "field_key": "notes", "field_uid": "p2p-field-9410", "is_filter": false, "is_search": false, "activity_id": "p2p-act-submit-invoice", "output_label": "Vendor Notes"}]}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;

-- Screens
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20027, 29643, 20, 'P2P - Finance Review Detail', 'desktop', 'P2P - Finance Review Detail', '[{"type": "element", "style": {"width": "100%", "padding": "16px"}, "config": {"type": "detailsview", "view_id": "29613"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20010, 29631, 20, 'P2P - My Invoices', 'desktop', 'P2P - My Invoices', '[{"type": "element", "style": {"marginBottom": "16px"}, "config": {"icon": "add", "name": "+ Submit New Invoice", "type": "button", "params": {"workflow_id": "wf_p2p_invoice_demo", "activity_id_init": "p2p-act-submit-invoice"}, "action_end": [{"type": "refresh_page"}], "job_template": "start_state_machine"}, "classes": ["z-btn-primary"]}, {"type": "element", "style": {"width": "100%"}, "config": {"type": "recordsview", "view_id": "29601"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20011, 29632, 20, 'P2P - Pending Clarifications', 'desktop', 'P2P - Pending Clarifications', '[{"type": "element", "style": {"width": "100%"}, "config": {"type": "recordsview", "view_id": "29602"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20012, 29633, 20, 'P2P - Finance Review', 'desktop', 'P2P - Finance Review', '[{"type": "element", "style": {"width": "100%"}, "config": {"type": "recordsview", "view_id": "29603"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20013, 29634, 20, 'P2P - All Invoices', 'desktop', 'P2P - All Invoices', '[{"type": "element", "style": {"width": "100%"}, "config": {"type": "recordsview", "view_id": "29604"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20025, 29641, 20, 'P2P - Invoice Detail', 'desktop', 'P2P - Invoice Detail', '[{"type": "element", "style": {"width": "100%", "padding": "16px"}, "config": {"type": "detailsview", "view_id": "29611"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;
INSERT INTO tbl_appconfig_screens (id, source_screen_id, app_id, screen_name, device, description, layout, permissions) VALUES (20026, 29642, 20, 'P2P - Clarification Detail', 'desktop', 'P2P - Clarification Detail', '[{"type": "element", "style": {"width": "100%", "padding": "16px"}, "config": {"type": "detailsview", "view_id": "29612"}}]'::jsonb, NULL) ON CONFLICT (id) DO UPDATE SET layout = EXCLUDED.layout;

-- RV Screens
INSERT INTO tbl_appconfig_rv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, rv_template_id) VALUES (20001, 29601, 20, 'Vendor - My Invoices', 'desktop', 'Vendor - My Invoices', '[{"type": "element", "style": {}, "config": {"type": "rv_table", "columns": [{"id": "current_state_name", "display": "Status", "key_name": "current_state_name", "data_type": "text"}, {"id": "invoice_number", "display": "Invoice #", "key_name": "invoice_number", "data_type": "text"}, {"id": "po_number", "display": "PO #", "key_name": "po_number", "data_type": "text"}, {"id": "total_amount", "display": "Amount", "key_name": "total_amount", "data_type": "number"}, {"id": "created_at", "display": "Submitted", "key_name": "created_at", "data_type": "datetime"}], "view_id": "29601", "on_row_click": {"screen_id": "29641", "job_template": "navigate_to_screen"}}}]'::jsonb, 29504) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_rv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, rv_template_id) VALUES (20002, 29602, 20, 'Department - Pending Clarifications', 'desktop', 'Department - Pending Clarifications', '[{"type": "element", "style": {}, "config": {"type": "rv_table", "columns": [{"id": "vendor_name", "display": "Vendor", "key_name": "vendor_name", "data_type": "text"}, {"id": "invoice_number", "display": "Invoice #", "key_name": "invoice_number", "data_type": "text"}, {"id": "total_amount", "display": "Amount", "key_name": "total_amount", "data_type": "number"}, {"id": "target_department", "display": "Department", "key_name": "target_department", "data_type": "text"}, {"id": "created_at", "display": "Created", "key_name": "created_at", "data_type": "datetime"}], "view_id": "29602", "on_row_click": {"screen_id": "29642", "job_template": "navigate_to_screen"}}}]'::jsonb, 29502) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_rv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, rv_template_id) VALUES (20003, 29603, 20, 'Finance - Review Queue', 'desktop', 'Finance - Review Queue', '[{"type": "element", "style": {}, "config": {"type": "rv_table", "columns": [{"id": "vendor_name", "display": "Vendor", "key_name": "vendor_name", "data_type": "text"}, {"id": "invoice_number", "display": "Invoice #", "key_name": "invoice_number", "data_type": "text"}, {"id": "total_amount", "display": "Amount", "key_name": "total_amount", "data_type": "number"}, {"id": "recommendation", "display": "AI Recommendation", "key_name": "recommendation", "data_type": "text"}, {"id": "recommended_amount", "display": "Recommended Amt", "key_name": "recommended_amount", "data_type": "number"}, {"id": "created_at", "display": "Created", "key_name": "created_at", "data_type": "datetime"}], "view_id": "29603", "on_row_click": {"screen_id": "29643", "job_template": "navigate_to_screen"}}}]'::jsonb, 29503) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_rv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, rv_template_id) VALUES (20004, 29604, 20, 'Admin - All Invoices', 'desktop', 'Admin - All Invoices', '[{"type": "element", "style": {}, "config": {"type": "rv_table", "columns": [{"id": "current_state_name", "display": "Status", "key_name": "current_state_name", "data_type": "text"}, {"id": "vendor_name", "display": "Vendor", "key_name": "vendor_name", "data_type": "text"}, {"id": "invoice_number", "display": "Invoice #", "key_name": "invoice_number", "data_type": "text"}, {"id": "po_number", "display": "PO #", "key_name": "po_number", "data_type": "text"}, {"id": "total_amount", "display": "Amount", "key_name": "total_amount", "data_type": "number"}, {"id": "created_at", "display": "Created", "key_name": "created_at", "data_type": "datetime"}], "view_id": "29604", "on_row_click": {"screen_id": "29641", "job_template": "navigate_to_screen"}}}]'::jsonb, 29501) ON CONFLICT (id) DO NOTHING;

-- DV Screens
INSERT INTO tbl_appconfig_dv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, dv_template_id) VALUES (20004, 29611, 20, 'Invoice Detail View', 'desktop', 'Invoice Detail View', '[{"type": "element", "style": {"fontSize": "16px", "marginTop": "20px", "fontWeight": "700", "borderBottom": "1px solid #e2e8f0", "marginBottom": "8px", "paddingBottom": "6px"}, "config": {"name": "Invoice Details", "type": "label"}, "classes": []}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Status", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Status", "keyName": "current_state_name"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Vendor", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Vendor", "keyName": "vendor_name"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Invoice Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Invoice #", "keyName": "invoice_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Invoice Date", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Date", "keyName": "invoice_date"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "PO Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "PO #", "keyName": "po_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Total Amount", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Amount", "keyName": "total_amount"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Tax Amount", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Tax", "keyName": "tax_amount"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Payment Terms", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Terms", "keyName": "payment_terms"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Vendor Notes", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Notes", "keyName": "notes"}}}]'::jsonb, 29511) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_dv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, dv_template_id) VALUES (20006, 29613, 20, 'Finance Review Detail View', 'desktop', 'Finance Review Detail View', '[{"type": "element", "style": {"fontSize": "16px", "marginTop": "20px", "fontWeight": "700", "borderBottom": "1px solid #e2e8f0", "marginBottom": "8px", "paddingBottom": "6px"}, "config": {"name": "Invoice Details", "type": "label"}, "classes": []}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Status", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Status", "keyName": "current_state_name"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Vendor", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Vendor", "keyName": "vendor_name"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Invoice Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Invoice #", "keyName": "invoice_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "PO Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "PO #", "keyName": "po_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Invoice Amount", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Amount", "keyName": "total_amount"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Tax", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Tax", "keyName": "tax_amount"}}}, {"type": "element", "style": {"fontSize": "16px", "marginTop": "20px", "fontWeight": "700", "borderBottom": "1px solid #e2e8f0", "marginBottom": "8px", "paddingBottom": "6px"}, "config": {"name": "AI Recommendation", "type": "label"}, "classes": []}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Recommendation", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Recommendation", "keyName": "recommendation"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Recommended Amount", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Amount", "keyName": "recommended_amount"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Match Summary", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Match Summary", "keyName": "match_summary"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "AI Reasoning", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Reasoning", "keyName": "ai_reasoning"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "AI Confidence", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Confidence", "keyName": "ai_confidence"}}}, {"type": "element", "style": {"display": "inline-block", "marginTop": "20px", "marginRight": "8px"}, "config": {"icon": "check_circle", "name": "Approve Payment", "type": "button", "params": {"activity_id": "p2p-act-approve-payment", "workflow_id": "wf_p2p_invoice_demo"}, "action_end": [{"type": "refresh_page"}], "job_template": "perform_activity"}, "classes": ["z-btn-primary"]}, {"type": "element", "style": {"display": "inline-block", "marginTop": "20px", "marginRight": "8px"}, "config": {"icon": "cancel", "name": "Reject Payment", "type": "button", "params": {"activity_id": "p2p-act-reject-payment", "workflow_id": "wf_p2p_invoice_demo"}, "action_end": [{"type": "refresh_page"}], "job_template": "perform_activity"}, "classes": ["z-btn-outline"]}, {"type": "element", "style": {"display": "inline-block", "marginTop": "20px"}, "config": {"icon": "pause_circle", "name": "Hold Payment", "type": "button", "params": {"activity_id": "p2p-act-hold-payment", "workflow_id": "wf_p2p_invoice_demo"}, "action_end": [{"type": "refresh_page"}], "job_template": "perform_activity"}, "classes": ["z-btn-outline"]}]'::jsonb, 29513) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_dv_screens (id, source_screen_id, app_id, screen_name, device, description, layout, dv_template_id) VALUES (20005, 29612, 20, 'Clarification Detail View', 'desktop', 'Clarification Detail View', '[{"type": "element", "style": {"fontSize": "16px", "marginTop": "20px", "fontWeight": "700", "borderBottom": "1px solid #e2e8f0", "marginBottom": "8px", "paddingBottom": "6px"}, "config": {"name": "Invoice Summary", "type": "label"}, "classes": []}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Vendor", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Vendor", "keyName": "vendor_name"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Invoice Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Invoice #", "keyName": "invoice_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "PO Number", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "PO #", "keyName": "po_number"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Amount", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Amount", "keyName": "total_amount"}}}, {"type": "element", "style": {"fontSize": "16px", "marginTop": "20px", "fontWeight": "700", "borderBottom": "1px solid #e2e8f0", "marginBottom": "8px", "paddingBottom": "6px"}, "config": {"name": "AI Clarification Request", "type": "label"}, "classes": []}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Target Department", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Department", "keyName": "target_department"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Question from AI", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Question", "keyName": "clarification_question"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Context", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Context", "keyName": "clarification_context"}}}, {"type": "element", "style": {"color": "#64748b", "fontSize": "13px", "marginTop": "12px", "fontWeight": "600"}, "config": {"name": "Analysis So Far", "type": "label"}, "classes": []}, {"type": "element", "style": {"marginBottom": "4px"}, "config": {"type": "field", "field": {"label": "Analysis", "keyName": "analysis_so_far"}}}, {"type": "element", "style": {"marginTop": "20px"}, "config": {"icon": "reply", "name": "Respond to Clarification", "type": "button", "params": {"activity_id": "p2p-act-provide-clarification", "workflow_id": "wf_p2p_invoice_demo"}, "action_end": [{"type": "refresh_page"}], "job_template": "perform_activity"}, "classes": ["z-btn-primary"]}]'::jsonb, 29512) ON CONFLICT (id) DO NOTHING;

-- Form Screens
INSERT INTO tbl_appconfig_form_screens (id, source_form_id, activity_uid, device_type, layout, grid_config, app_id) VALUES (20136, 20094, 'p2p-act-submit-invoice', 'desktop', '[]'::jsonb, '[{"h": 1, "i": "p2p-field-9401", "w": 6, "x": 0, "y": 0}, {"h": 1, "i": "p2p-field-9402", "w": 6, "x": 6, "y": 0}, {"h": 1, "i": "p2p-field-9403", "w": 6, "x": 0, "y": 1}, {"h": 1, "i": "p2p-field-9404", "w": 6, "x": 6, "y": 1}, {"h": 1, "i": "p2p-field-9405", "w": 6, "x": 0, "y": 2}, {"h": 1, "i": "p2p-field-9406", "w": 6, "x": 6, "y": 2}, {"h": 1, "i": "p2p-field-9407", "w": 6, "x": 0, "y": 3}, {"h": 1, "i": "p2p-field-9408", "w": 6, "x": 6, "y": 3}, {"h": 1, "i": "p2p-field-9409", "w": 6, "x": 0, "y": 4}, {"h": 1, "i": "p2p-field-9410", "w": 6, "x": 6, "y": 4}]'::jsonb, 20) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_form_screens (id, source_form_id, activity_uid, device_type, layout, grid_config, app_id) VALUES (20137, 20095, 'p2p-act-provide-clarification', 'desktop', '[]'::jsonb, '[{"h": 1, "i": "p2p-field-9415", "w": 12, "x": 0, "y": 0}, {"h": 1, "i": "p2p-field-9416", "w": 12, "x": 0, "y": 1}, {"h": 1, "i": "p2p-field-9417", "w": 12, "x": 0, "y": 2}]'::jsonb, 20) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_form_screens (id, source_form_id, activity_uid, device_type, layout, grid_config, app_id) VALUES (20138, 20096, 'p2p-act-approve-payment', 'desktop', '[]'::jsonb, '[{"h": 1, "i": "p2p-field-9423", "w": 6, "x": 0, "y": 0}, {"h": 1, "i": "p2p-field-9424", "w": 6, "x": 6, "y": 0}]'::jsonb, 20) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_form_screens (id, source_form_id, activity_uid, device_type, layout, grid_config, app_id) VALUES (20139, 20097, 'p2p-act-reject-payment', 'desktop', '[]'::jsonb, '[{"h": 1, "i": "p2p-field-9425", "w": 12, "x": 0, "y": 0}, {"h": 1, "i": "p2p-field-9426", "w": 12, "x": 0, "y": 1}]'::jsonb, 20) ON CONFLICT (id) DO NOTHING;
INSERT INTO tbl_appconfig_form_screens (id, source_form_id, activity_uid, device_type, layout, grid_config, app_id) VALUES (20140, 20098, 'p2p-act-hold-payment', 'desktop', '[]'::jsonb, '[{"h": 1, "i": "p2p-field-9427", "w": 12, "x": 0, "y": 0}, {"h": 1, "i": "p2p-field-9428", "w": 12, "x": 0, "y": 1}]'::jsonb, 20) ON CONFLICT (id) DO NOTHING;

-- Header Config
INSERT INTO tbl_appconfig_header_config (id, app_id, device_type, config) VALUES (20001, 20, 'desktop', '{"slots": {"left": ["logo", "nav"], "right": ["profile"], "center": []}, "layout": {"type": "classic", "height": "56px", "position": "sticky", "full_width": true}, "components": {"nav": {"items": [{"id": "nav_vendor", "icon": "receipt_long", "type": "screen", "label": "My Invoices", "screen_id": 29631}, {"id": "nav_clarifications", "icon": "help_outline", "type": "screen", "label": "Pending Clarifications", "screen_id": 29632}, {"id": "nav_finance", "icon": "account_balance", "type": "screen", "label": "Finance Review", "screen_id": 29633}, {"id": "nav_all", "icon": "list_alt", "type": "screen", "label": "All Invoices", "screen_id": 29634}]}, "logo": {"text": "P2P Invoice System", "display_type": "text"}, "profile": {"shape": "circle", "show_name": true}}}'::jsonb) ON CONFLICT (id) DO UPDATE SET config = EXCLUDED.config;
