feat: show project number in document title

master
Katja Lutz 2 years ago
parent 46a08fc60a
commit a24875cf36

@ -26,6 +26,8 @@ import {
localStoreSchema, localStoreSchema,
POSITION_TYPE_AGILE, POSITION_TYPE_AGILE,
POSITION_TYPE_QUANTITY, POSITION_TYPE_QUANTITY,
PrintType,
printTypeTitles,
PRINT_TYPE_CONFIRMATION, PRINT_TYPE_CONFIRMATION,
PRINT_TYPE_INVOICE, PRINT_TYPE_INVOICE,
PRINT_TYPE_OFFER, PRINT_TYPE_OFFER,
@ -876,15 +878,17 @@ const SettingsOverlay: Component = () => {
}} }}
> >
<For <For
each={[ each={
[PRINT_TYPE_OFFER, "Offerte"], [
[PRINT_TYPE_CONFIRMATION, "Bestätigung"], PRINT_TYPE_OFFER,
[PRINT_TYPE_INVOICE, "Rechnung"], PRINT_TYPE_CONFIRMATION,
]} PRINT_TYPE_INVOICE,
] as PrintType[]
}
> >
{([type, label]) => ( {(type) => (
<option value={type} selected={type === uiState.printType}> <option value={type} selected={type === uiState.printType}>
{label} {printTypeTitles[type]}
</option> </option>
)} )}
</For> </For>

@ -26,6 +26,7 @@ import {
createStore, createStore,
createUiStore, createUiStore,
LocalStoreContext, LocalStoreContext,
printTypeTitles,
PRINT_TYPE_CONFIRMATION, PRINT_TYPE_CONFIRMATION,
PRINT_TYPE_INVOICE, PRINT_TYPE_INVOICE,
PRINT_TYPE_OFFER, PRINT_TYPE_OFFER,
@ -128,10 +129,11 @@ export default function Home() {
const titleMemo = createMemo( const titleMemo = createMemo(
() => () =>
(state.positions.length > 0 ? `(${state.positions.length}) ` : "") + (state.positions.length > 0 ? `(${state.positions.length}) ` : "") +
"Räppli" + "Räppli - " +
(state.project.projectNumber.length (state.project.projectNumber.length > 0
? ` - ${state.project.projectNumber}` ? `${state.project.projectNumber} - `
: "") : "") +
printTypeTitles[uiState.printType]
); );
return ( return (

@ -29,13 +29,21 @@ export const PRINT_TYPE_OFFER = "OFFER";
export const PRINT_TYPE_CONFIRMATION = "CONFIRMATION"; export const PRINT_TYPE_CONFIRMATION = "CONFIRMATION";
export const PRINT_TYPE_INVOICE = "INVOICE"; export const PRINT_TYPE_INVOICE = "INVOICE";
export type PrintType =
| typeof PRINT_TYPE_OFFER
| typeof PRINT_TYPE_CONFIRMATION
| typeof PRINT_TYPE_INVOICE;
export const printTypeTitles = {
[PRINT_TYPE_OFFER]: "Offerte",
[PRINT_TYPE_CONFIRMATION]: "Bestätigung",
[PRINT_TYPE_INVOICE]: "Rechnung",
};
export const createUiStore = () => export const createUiStore = () =>
createStore_({ createStore_({
lastSaved: 0, lastSaved: 0,
printType: PRINT_TYPE_INVOICE as printType: PRINT_TYPE_INVOICE as PrintType,
| typeof PRINT_TYPE_OFFER
| typeof PRINT_TYPE_CONFIRMATION
| typeof PRINT_TYPE_INVOICE,
selectedPosition: undefined as undefined | number, selectedPosition: undefined as undefined | number,
}); });
export type UiStore = ReturnType<typeof createUiStore>; export type UiStore = ReturnType<typeof createUiStore>;

Loading…
Cancel
Save