feat: show project number in document title

master
Katja Lutz 2 years ago
parent 46a08fc60a
commit a24875cf36

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

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

@ -29,13 +29,21 @@ export const PRINT_TYPE_OFFER = "OFFER";
export const PRINT_TYPE_CONFIRMATION = "CONFIRMATION";
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 = () =>
createStore_({
lastSaved: 0,
printType: PRINT_TYPE_INVOICE as
| typeof PRINT_TYPE_OFFER
| typeof PRINT_TYPE_CONFIRMATION
| typeof PRINT_TYPE_INVOICE,
printType: PRINT_TYPE_INVOICE as PrintType,
selectedPosition: undefined as undefined | number,
});
export type UiStore = ReturnType<typeof createUiStore>;

Loading…
Cancel
Save