fix(webapp): correct API endpoint URLs for universal search

Update resource URL mappings to match backend NestJS controller routes:
- /sales/invoices -> /sale-invoices
- /sales/estimates -> /sale-estimates
- /sales/receipts -> /sale-receipts
- /purchases/bills -> /bills
- /sales/payment_receives -> /payments-received
- /purchases/bill_payments -> /bill-payments
- /sales/credit_notes -> /credit-notes
- /purchases/vendor-credit -> /vendor-credits

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Ahmed Bouhuolia
2026-02-09 13:40:18 +02:00
parent 8689962bf3
commit c47acdee03

View File

@@ -32,19 +32,19 @@ export function useResourceData(type, query, props) {
*/ */
function getResourceUrlFromType(type) { function getResourceUrlFromType(type) {
const config = { const config = {
[RESOURCES_TYPES.INVOICE]: '/sales/invoices', [RESOURCES_TYPES.INVOICE]: '/sale-invoices',
[RESOURCES_TYPES.ESTIMATE]: '/sales/estimates', [RESOURCES_TYPES.ESTIMATE]: '/sale-estimates',
[RESOURCES_TYPES.ITEM]: '/items', [RESOURCES_TYPES.ITEM]: '/items',
[RESOURCES_TYPES.RECEIPT]: '/sales/receipts', [RESOURCES_TYPES.RECEIPT]: '/sale-receipts',
[RESOURCES_TYPES.BILL]: '/purchases/bills', [RESOURCES_TYPES.BILL]: '/bills',
[RESOURCES_TYPES.PAYMENT_RECEIVE]: '/sales/payment_receives', [RESOURCES_TYPES.PAYMENT_RECEIVE]: '/payments-received',
[RESOURCES_TYPES.PAYMENT_MADE]: '/purchases/bill_payments', [RESOURCES_TYPES.PAYMENT_MADE]: '/bill-payments',
[RESOURCES_TYPES.CUSTOMER]: '/customers', [RESOURCES_TYPES.CUSTOMER]: '/customers',
[RESOURCES_TYPES.VENDOR]: '/vendors', [RESOURCES_TYPES.VENDOR]: '/vendors',
[RESOURCES_TYPES.MANUAL_JOURNAL]: '/manual-journals', [RESOURCES_TYPES.MANUAL_JOURNAL]: '/manual-journals',
[RESOURCES_TYPES.ACCOUNT]: '/accounts', [RESOURCES_TYPES.ACCOUNT]: '/accounts',
[RESOURCES_TYPES.CREDIT_NOTE]: '/sales/credit_notes', [RESOURCES_TYPES.CREDIT_NOTE]: '/credit-notes',
[RESOURCES_TYPES.VENDOR_CREDIT]: '/purchases/vendor-credit', [RESOURCES_TYPES.VENDOR_CREDIT]: '/vendor-credits',
}; };
return config[type] || ''; return config[type] || '';
} }