Add comprehensive export system supporting CSV, XLSX, JSON, PDF#7
Open
Add comprehensive export system supporting CSV, XLSX, JSON, PDF#7
Conversation
Implement a unified export framework supporting all major data views: - Order list, revenue/profit, production/factory floor, inventory, supply intake, and shipping chart exports - All 4 formats: CSV (BOM for Excel JP), XLSX (caxlsx), PDF (Prawn), and JSON with metadata - Async generation via Solid Queue (ExportJob) with Message tracking - Reusable export button partial with format dropdown + date range modal - Pundit authorization (ExportPolicy) matching order read access - Japanese-first i18n translations (exports.ja.yml + exports.en.yml) - Export buttons wired into all dashboard tabs (orders, revenue, shipping, production, supply usage, supply dates) - Comprehensive test suite: 9 test files covering base export, all data exporters, job execution, and controller authorization https://claude.ai/code/session_01VBKF79FuRwrf32F3WFCTJ6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a unified, extensible export system for the Oroshi application supporting CSV, XLSX, JSON, and PDF formats across all major data views (Orders, Revenue, Production, Inventory, Supply, and Shipping). All exports are processed asynchronously via Solid Queue using the existing
Message+ActiveStoragepattern.Key Changes
Core Export Infrastructure
lib/exports/base_export.rb: Abstract base class providing format dispatch, data loading, filtering, and column definitionscsv_export.rb,xlsx_export.rb,json_export.rb,pdf_export.rbfor format-specific generationorders_export.rb,revenue_export.rb,production_export.rb,inventory_export.rb,supply_export.rb,shipping_export.rbwith Japanese column headers and domain-specific logicJob & Controller
app/jobs/oroshi/export_job.rb: Unified async job replacing per-document-type pattern; generates content and attaches toMessage.stored_fileapp/controllers/oroshi/exports_controller.rb: Handles export requests with validation for export types and formats; createsMessagerecords and enqueues jobsUI & Localization
app/views/oroshi/exports/_export_button.html.erb: Reusable dropdown button partial for all dashboard viewsapp/views/oroshi/exports/_date_range_export.html.erb: Modal form for date range selectionconfig/locales/exports.ja.yml&exports.en.yml: Japanese and English translationsapp/helpers/oroshi/exports_helper.rb: Format icon mapping helperAuthorization & Routing
app/policies/oroshi/export_policy.rb: Policy allowing Admin, VIP, and Employee roles to exportconfig/routes.rb: Addedresources :exports, only: [:create]routeTesting
Implementation Details
caxlsxgem), JSON (with metadata), PDF (via existingPrintableclass)Message.state(nil → true/false) and attach files toMessage.stored_fileOroshiOrderDocumentfor B4 landscape layout; CSV/XLSX/JSON provide flattened dataDependencies
Added
gem "caxlsx"for XLSX generation (community-maintained successor to axlsx).https://claude.ai/code/session_01VBKF79FuRwrf32F3WFCTJ6