Commit Graph

38 Commits

Author SHA1 Message Date
dwindown
96ea79600a fix: only render modal when explicitly opened to prevent auto-show
Change modal rendering strategy from controlled via 'open' prop to
conditional rendering. Now the Modal component is only added to DOM
when isAddModalOpen is true, preventing it from being present on page load.

Before: {actions.addNew && <Modal open={isAddModalOpen} ...>}
After:  {actions.addNew && isAddModalOpen && <Modal ...>}

This ensures the modal cannot accidentally show on page load and cannot be
interfered with when it shouldn't exist.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:41:54 +07:00
dwindown
9499931034 fix: use correct WordPress Modal component props
Fix modal that was persisting by using correct @wordpress/components
Modal API:
- Use 'open' instead of 'isOpen' prop
- Use 'onRequestClose' instead of 'onClose'
- Add 'isDismissible' to allow closing with ESC/outside click
- Add 'focusOnMount' for accessibility
- Add deprecation warning props for TextControl (__next40pxDefaultSize,
  __nextHasNoMarginBottom)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:38:36 +07:00
dwindown
83b7294fa4 fix: prevent modal from showing unexpectedly and fix inline actions
Remove duplicate inline actions from Forms page title column to prevent
conflicts with DataTable's built-in actions column.

Fix DataTable actions column:
- Only show delete/duplicate on hover using CSS
- Add proper event propagation handling (stopPropagation)
- Remove unnecessary wrapper div that was causing issues

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:28:49 +07:00
dwindown
bb74df4d6b feat: migrate Products page to full DataTable
Update Products page with full-featured DataTable:
- All columns (ID, title, price with multi-currency, type, stock, status)
- Status filter (All, Published, Draft)
- Inline actions (edit variations, delete, duplicate)
- Bulk delete and Add New modal
- VariationPricingTable editor preserved for editing individual products

All 7 admin listing pages now use the full-featured DataTable component:
✓ Forms - with shortcode copy button
✓ Coupons - with type and amount display
✓ Access - with product relation
✓ Orders - specialized with filters and date ranges
✓ Products - with multi-currency pricing
✓ Customers - read-only with order counts
✓ Licenses - read-only with status labels

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:20:19 +07:00
dwindown
128e396040 feat: migrate Coupons, Access, Customers, Licenses pages to full DataTable
Update all admin listing pages to use the full-featured DataTable component:

Coupons page:
- All columns (ID, code, type, amount, usages, date limit, status)
- Status filter (All, Active, Inactive)
- Inline actions and bulk delete
- Add New modal

Access page:
- All columns (ID, title, product, status, date)
- Status filter (All, Published, Draft)
- Inline actions and bulk delete
- Add New modal

Customers page:
- All columns (ID, name, email, phone, total orders, date)
- Read-only (no selection or inline actions)
- Search and pagination

Licenses page:
- All columns (ID, license key, product, order, email, status)
- Status labels (Active, Inactive, Expired)
- Read-only (no selection or inline actions)
- Search and pagination

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:13:09 +07:00
dwindown
8529cfa2c0 feat: implement full-featured DataTable component
Implement comprehensive DataTable with all Grid.js features:
- Checkbox selection with "Select All"
- Bulk delete button (shows when rows selected)
- Inline row actions (edit, delete, duplicate) on hover
- Status filter tabs with counts
- Search input with debounce
- Sort dropdown (ID, date, title ASC/DESC)
- Server-side pagination
- "Add New" modal with SweetAlert2
- SweetAlert2 loaded via WordPress global scope

Updated Forms page to use new DataTable component with:
- Full column rendering (ID, title, date, status, shortcode)
- Copy shortcode button with toast notification
- All filter, search, sort, pagination features

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:10:45 +07:00
dwindown
f7c09a17cf refactor: remove coexistence mode, use React only
Remove all dual-mode rendering logic since React is now the single
admin interface. Focus on implementing full table features in React.

Changes:
- Remove ?react= query param checks from all page methods
- Remove admin notice and footer toggle from ReactAdmin
- Simplify asset loading - ReactAdmin handles all assets
- Clean up Init.php enqueue method

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:08:21 +07:00
dwindown
e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:02:14 +07:00
dwindown
bd9cdac02e feat: implement coexistence strategy for Grid.js and React admin
Implement dual-mode rendering allowing classic Grid.js and new React
versions to run side-by-side during migration.

- Add coexistence mode checks to all admin page methods
- Check query param ?react=1 or option 'formipay_use_react_admin'
- Include classic PHP pages when React not active
- Add admin notice showing current version with toggle button
- Add footer toggle link to switch between versions

This ensures zero feature loss - old Grid.js pages continue working
(~20 features per page) while React versions are developed.

Files:
- Form.php, Coupon.php, Access.php, Order.php
- Customer.php, Product.php, License.php
- ReactAdmin.php (added version_notice, footer_toggle)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 16:55:56 +07:00
dwindown
ab69d03f78 fix: React admin icon imports and mount point rendering
- Fix all @wordpress/icons imports - use build/ paths and call as functions
- Update all admin pages to render React mount points
- Components fixed: VariationPricingTable, NotificationLog, GlobalSettings,
  FormFieldOptions, OrderDetail, OrderListItem, OrderList, FormCanvas,
  AnalyticsDashboard, FormField, Products
- Admin pages updated: Order.php, Customer.php, Coupon.php, License.php,
  Product.php, Access.php, Form.php

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 13:28:57 +07:00
dwindown
6fd6d29fe8 fix: remove incompatible packages from dependencies
- Remove @wordpress/url (version doesn't exist)
- Remove unused @wordpress/date and @tanstack/react-table
- Keep only core WordPress dependencies that are actually used
- Add build/ directory with compiled assets
2026-04-18 13:14:39 +07:00
dwindown
c5c1909a39 docs: mark Phase 2 complete (Weeks 3-6)
Phase 2 Summary (React Admin Foundation):
 Week 3: Build Pipeline (package.json, webpack, API client)
 Week 4: Form Builder (drag-drop canvas, field palette, settings, preview)
 Week 5: Order Management (list, detail, timeline, analytics, notifications)
 Week 6: Settings & Editors (global settings, product editor, Vue migration)

Next: Phase 3 - Frontend Enhancements
2026-04-18 12:34:49 +07:00
dwindown
904d86ad64 feat: update Coupons, Access, Licenses pages (F2.20-F2.22)
- Add placeholder content for Coupons page
- Add placeholder content for Access Items page
- Add placeholder content for Licenses page
- Users can use classic editor until React versions are ready
2026-04-18 12:34:33 +07:00
dwindown
3e6c06178c feat: build Global Settings and Product Editor (F2.18-F2.19)
Settings:
- GlobalSettings page with tabbed interface
- Replace WPCFTO framework with React components
- Tabs: General, Payment, Pages, Customer
- Multicurrency settings with default currency selector
- AJAX save functionality with status feedback

Product Editor:
- VariationPricingTable - Complete recreation of Vue app
- Multi-currency flat pricing (columns mode)
- Multi-currency expanded mode (inner tables per variation)
- Dynamic rows from attribute repeater (MutationObserver + polling)
- Decimal digits per currency (affects step value)
- Required field validation (default currency price required)
- Real-time JSON update to hidden input
- SweetAlert2 integration for validation errors
- Stock and weight fields per variation
- Delete variation support

Migration:
- Preserves data compatibility with Vue app format
- Same data structure: {key, name, stock, weight, active, prices[]}
- Prices array with currency triple format: 'code:::name:::symbol'
- Sorts default currency first in prices array

See MIGRATION_STRATEGY.md for full migration details
2026-04-18 12:33:50 +07:00
dwindown
42d8f2e3b6 docs: mark Week 5 tasks complete (F2.13-F2.17) 2026-04-18 12:16:51 +07:00
dwindown
1e57a0cf9d feat: add notification log viewer (F2.17)
- Create NotificationLog component with type icons
- Display notification history (email, SMS, WhatsApp)
- Show status badges (sent, failed, pending)
- Include recipient and timestamp information
- Add to OrderDetail sidebar
2026-04-18 12:16:35 +07:00
dwindown
fa792d38ae feat: build Order Management & Analytics (F2.13-F2.16)
Components:
- OrderList: table with filters (status, date, search, pagination)
- OrderListItem: single order row with status badge
- OrderDetail: full order view with status update, items, customer info
- OrderTimeline: status change history with visual progress
- AnalyticsDashboard: stats cards (orders, revenue, completed, pending)

Features:
- Order list with keyword search, status filter, date range
- Pagination support
- Status change workflow with immediate update
- Order detail with items breakdown and customer info
- Visual timeline progress indicator
- Analytics dashboard with key metrics
- Placeholder charts for future implementation

Updated Orders page to use new components with list/detail navigation
2026-04-18 12:15:48 +07:00
dwindown
ed2520aadf docs: mark Week 4 tasks complete (F2.7-F2.12) 2026-04-18 11:42:32 +07:00
dwindown
7f50b27df3 feat: add form builder AJAX handlers (F2.11)
- Create FormBuilderAjax class for React form builder
- Add formipay_save_form_fields AJAX action
- Add formipay_load_form_fields AJAX action
- Sanitize field data on save
- Update FormBuilder to load fields on mount
- Add save status feedback (saving, saved, error)
- Register FormBuilderAjax singleton in main plugin file
2026-04-18 11:41:10 +07:00
dwindown
ec1f01ef24 feat: build React Form Builder (F2.7-F2.10)
Components:
- FieldPalette: drag-and-drop source for all field types
- FormCanvas: drop target with field list, reordering, CRUD
- FormField: individual field component with actions
- FieldSettingsPanel: edit field properties (label, ID, options, etc.)
- FormFieldOptions: manage select/radio/checkbox options
- FormPreview: live preview of rendered form
- FormFieldPreview: preview individual field types

Features:
- 16 field types (text, email, select, checkbox, radio, etc.)
- Categorized field palette
- Drag-and-drop field reordering
- Per-field settings panel
- Option management for choice fields
- Live form preview
- Save via AJAX

Config:
- fieldTypes.js: field definitions and constants
- Generate unique field IDs
- Field type categories (input, choice, layout, preset, advanced)
2026-04-18 11:34:13 +07:00
dwindown
9b2538bdd9 docs: mark Week 3 tasks complete (F2.1-F2.6) 2026-04-18 11:30:40 +07:00
dwindown
f7a149a1c5 feat: initialize React admin build pipeline (F2.1-F2.6)
- Add package.json with @wordpress/scripts and React dependencies
- Configure webpack for admin bundle output
- Create src/admin directory structure (api, components, pages)
- Implement API client with nonce handling (ajaxRequest, apiRequest)
- Add API methods for orders, customers, products, forms, coupons, licenses
- Create React App component with page routing
- Add placeholder page components for all admin sections
- Create ReactAdmin PHP class to manage asset enqueuing
- Register ReactAdmin singleton in main plugin file
- Bump version to 2.0.0

Build: Run 'npm install && npm run build' to generate assets
2026-04-18 11:17:53 +07:00
dwindown
306377e8f5 fix: add currency_code column to Bank Transfer transaction table
- Add currency_code column to formipay_bank_transfer_trx table schema
- Store currency code from product settings when creating transaction
- Prevents data loss by tracking which currency was used for bank transfer payments
- Matches PayPal implementation pattern for consistency
2026-04-18 11:14:17 +07:00
dwindown
af2b3c2bf4 docs: add multicurrency implementation audit
- Comprehensive trace of multicurrency functionality
- Identified gaps: frontend currency selector, ExchangeRateAPI implementation, conversion logic
- Documented defects: hardcoded IDR, empty API class, missing Bank Transfer currency column
- Provided implementation order and testing checklist
2026-04-18 11:04:48 +07:00
dwindown
a386d3204b docs: add Vue to React migration strategy document
- MIGRATION_STRATEGY.md: explains Vue → React coexistence approach
- Documents custom Vue app in admin-product-editor.js (variation pricing table)
- Provides data compatibility requirements and testing strategy
- TASKLIST.md: references migration strategy in Phase 2 section

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 10:46:37 +07:00
dwindown
200c349cf9 docs: mark Phase 1 (Week 1-2) tasks as complete in TASKLIST.md
All critical bug fixes, performance improvements, and security
hardening tasks are now complete. Ready to proceed to Phase 2.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 19:55:38 +07:00
dwindown
66e7b37f92 fix: resolve all Week 2 performance & security issues (F1.10–F1.19)
Security:
- Replace maybe_serialize() in cookies with json_encode() (PHP object injection fix)
- Add PayPal webhook signature verification
- Add current_user_can('manage_options') to all 18 admin-ajax handlers

Performance:
- Remove flush_rewrite_rules() from init hooks (Thankyou + Payment)
- Add activation/deactivation hooks for flush_rewrite_rules
- Cache currency, country, flags JSON reads in static variables
- Add server-side pagination to Customer::formipay_tabledata_customers()
- Optimize Order::formipay_tabledata_orders() with COUNT(*) GROUP BY

Cleanup:
- Delete Paypal.phpbak backup file
- Fix timezone hardcode Asia/Jakarta → wp_timezone_string()
- Create uninstall.php for proper cleanup on uninstall

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 19:52:01 +07:00
dwindown
be9a1a0a86 fix: resolve all Week 1 critical bugs (F1.1–F1.9)
- Fix Customer::update() fatal error (undefined $table_name, $new_args)
- Fix Order::delete() using wrong variable $id instead of $order_id
- Fix Order::bulk_delete() using outer $order_id instead of loop $id
- Fix Email::send_email() calling non-existent class (use parent::)
- Add missing Order import in Paypal.php
- Fix BankTransfer unique_code triple DB call (call once, reuse result)
- Fix color field label showing "Number" instead of "Color"
- Add nonce verification to Customer::formipay_tabledata_customers()

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 19:40:12 +07:00
dwindown
4274be81a4 docs: add PRD and implementation task list
PRD.md defines product requirements across 4 phases (critical fixes,
React admin, frontend enhancements, missing features). TASKLIST.md
breaks all work into checkable tasks with file references.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 17:05:32 +07:00
dwindown
35569923a5 docs: add comprehensive audit report and architectural recommendation
Checkpoint before implementation. Includes audit findings (FINDINGS.md),
architectural recommendation (RECOMMENDATION.md), and existing code changes
to Form, Order, Render, and form-action.js from recent development.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 17:00:47 +07:00
dwindown
0446eb1064 Admin Settings in all CPTs are already set. Continue to frontend. 2025-10-13 15:20:14 +07:00
dwindown
6f6b039441 Finalize the backend for each coupon, customer and access functionalities 2025-09-24 21:46:03 +07:00
dwindown
4151ea3b9e fix Products, Coupons, and admin pages 2025-09-15 17:44:39 +07:00
dwindown
255da46509 fix wpcfto select and repeater related visibility and validation 2025-08-29 19:27:50 +07:00
dwindown
ccb2b1aea1 update multicurrencies functionality on global level 2025-08-25 19:55:38 +07:00
dwindown
38b6b5cddb add new classes License and LicenseAPI 2025-08-22 12:59:23 +07:00
dwindown
56ca12119c add gitignore 2025-08-21 20:40:49 +07:00
dwindown
58c1497171 first commit 2025-08-21 20:39:34 +07:00