refactor: implement toCamelCase utility function and update quotation stats mapping
This commit is contained in:
parent
5e3c04be8e
commit
4f085e068a
2 changed files with 10 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ import useMyBranch from 'stores/my-branch';
|
||||||
import { useQuotationForm } from './form';
|
import { useQuotationForm } from './form';
|
||||||
import { hslaColors } from './constants';
|
import { hslaColors } from './constants';
|
||||||
import { pageTabs, columnQuotation } from './constants';
|
import { pageTabs, columnQuotation } from './constants';
|
||||||
|
import { toCamelCase } from 'stores/utils';
|
||||||
|
|
||||||
// NOTE Import Types
|
// NOTE Import Types
|
||||||
import { CustomerBranchCreate, CustomerType } from 'stores/customer/types';
|
import { CustomerBranchCreate, CustomerType } from 'stores/customer/types';
|
||||||
|
|
@ -393,7 +394,9 @@ async function storeDataLocal(id: string) {
|
||||||
quotationStats[
|
quotationStats[
|
||||||
pageState.currentTab === 'Invoice'
|
pageState.currentTab === 'Invoice'
|
||||||
? 'paymentInProcess'
|
? 'paymentInProcess'
|
||||||
: (pageState.currentTab.toLowerCase() as keyof typeof quotationStats)
|
: (toCamelCase(
|
||||||
|
pageState.currentTab,
|
||||||
|
) as keyof typeof quotationStats)
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
</q-badge>
|
</q-badge>
|
||||||
|
|
|
||||||
|
|
@ -609,3 +609,9 @@ export function getEmployeeName(
|
||||||
['tha']: `${typeof employee.namePrefix === 'string' ? useOptionStore().mapOption(employee.namePrefix) : ''} ${employee.firstName} ${employee.lastName}`,
|
['tha']: `${typeof employee.namePrefix === 'string' ? useOptionStore().mapOption(employee.namePrefix) : ''} ${employee.firstName} ${employee.lastName}`,
|
||||||
}[opts?.locale || 'eng'];
|
}[opts?.locale || 'eng'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toCamelCase(text: string): string {
|
||||||
|
return text
|
||||||
|
.replace(/[^a-zA-Z0-9]+(.)/g, (match, chr) => chr.toUpperCase())
|
||||||
|
.replace(/^[A-Z]/, (match) => match.toLowerCase());
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue