|
1 | 1 | import { BasicEntry } from "shared/components.ts"; |
2 | 2 | import { ProfileData, RegisterAuthRefresh, sheetStack, showProfilePicture } from "shared/helper.ts"; |
3 | 3 | import { placeholder } from "shared/mod.ts"; |
4 | | -import { asRef, Box, Content, createCachedLoader, createIndexPaginationLoader, createPage, createRoute, DateInput, DropDown, Empty, Entry, Grid, Label, PrimaryButton, SheetHeader, Spinner, TextButton, TextInput, WriteSignal } from "webgen/mod.ts"; |
| 4 | +import { asRef, Box, Checkbox, Content, createCachedLoader, createIndexPaginationLoader, createPage, createRoute, DateInput, DropDown, Empty, Entry, Grid, Label, PrimaryButton, SheetHeader, Spinner, TextButton, TextInput, WriteSignal } from "webgen/mod.ts"; |
5 | 5 | import { API, PaymentType, SearchReturn, stupidErrorAlert, User, Wallet, zAccountType } from "../../../spec/mod.ts"; |
6 | 6 | import { WalletView } from "../../wallet/component.ts"; |
7 | 7 | import { ReviewEntry } from "../entries.ts"; |
@@ -85,13 +85,26 @@ export const walletSheet = (wallet: WriteSignal<Wallet>) => { |
85 | 85 | await API.patchIdByWalletsByAdmin({ path: { id: wallet.getValue()._id }, body: { cut: val } }).then(stupidErrorAlert); |
86 | 86 | wallet.setValue({ ...wallet.getValue(), cut: Number(val) }); |
87 | 87 | }); |
| 88 | + const copyrightEditable = asRef(wallet.getValue().copyrightEditable ?? false); |
| 89 | + copyrightEditable.listen(async (val, oldVal) => { |
| 90 | + if (oldVal === undefined) { |
| 91 | + return; |
| 92 | + } |
| 93 | + await API.patchIdByWalletsByAdmin({ path: { id: wallet.getValue()._id }, body: { copyrightEditable: val } }).then(stupidErrorAlert); |
| 94 | + wallet.setValue({ ...wallet.getValue(), copyrightEditable: val }); |
| 95 | + }); |
| 96 | + |
88 | 97 | return Grid( |
89 | 98 | SheetHeader("Wallet", sheetStack), |
90 | 99 | Grid( |
91 | 100 | DropDown(Object.values(zAccountType.enum), selectedAccountType, "AccountType"), |
92 | 101 | TextInput(selectedCut, "Cut", "change"), |
93 | 102 | PrimaryButton("Add Transaction").onClick(() => sheetStack.addSheet(addTransactionSheet(wallet))), |
94 | | - ).setEvenColumns(3).setGap(), |
| 103 | + Box( |
| 104 | + Checkbox(copyrightEditable), |
| 105 | + Label("Copyright Editable"), |
| 106 | + ), |
| 107 | + ).setEvenColumns(4).setGap(), |
95 | 108 | wallet.map((wallet) => WalletView(wallet)).value, |
96 | 109 | ); |
97 | 110 | }; |
|
0 commit comments