diff --git a/apps/hq-web/src/pages/ClientDetail.tsx b/apps/hq-web/src/pages/ClientDetail.tsx index 4c3b48f..3be032d 100644 --- a/apps/hq-web/src/pages/ClientDetail.tsx +++ b/apps/hq-web/src/pages/ClientDetail.tsx @@ -29,7 +29,7 @@ import { } from './Tickets' import { AccountOwnerSelect, AmcDialog, AssignModuleForm, ClientModuleStatusSelect, - InteractionDialog, PaymentForm, PlanDialog, RowDate, + InteractionDialog, PaymentForm, PlanDialog, } from './client-forms' import { ClientFormDialog } from '../components/ClientFormDialog' import { PulseRibbon } from '../components/PulseRibbon' @@ -268,11 +268,8 @@ export function ClientDetail() { {modules.data !== undefined && ( { + onAssign={(moduleId, kind) => { assignClientModule(id, { moduleId, kind }) - .then((cm) => creds !== undefined - ? patchClientModule(cm.id, { username: creds.username, password: creds.password }) - : cm) .then(() => { toast.ok('Module assigned'); cms.reload(); ledger.reload() }) .catch((err: Error) => toast.err(err.message)) }} @@ -285,8 +282,6 @@ export function ClientDetail() { columns={[ { key: 'module', label: 'Module' }, { key: 'kind', label: 'Kind' }, { key: 'status', label: 'Status' }, - { key: 'installed', label: 'Installed' }, { key: 'completed', label: 'Completed' }, - { key: 'trained', label: 'Trained' }, { key: 'billed', label: 'Billed', numeric: true }, { key: 'settled', label: 'Settled', numeric: true }, ]} @@ -296,9 +291,6 @@ export function ClientDetail() { module: moduleName(cm.moduleId), kind: KIND_LABEL[cm.kind], status: cms.reload()} onError={toast.err} />, - installed: cms.reload()} onError={toast.err} />, - completed: cms.reload()} onError={toast.err} />, - trained: cms.reload()} onError={toast.err} />, billed: paid !== undefined ? inr(paid.billedPaise) : '—', settled: paid !== undefined ? inr(paid.settledPaise) : '—', } @@ -314,6 +306,9 @@ export function ClientDetail() { {moduleName(cm.moduleId)} {cm.status} {KIND_LABEL[cm.kind]} + e.stopPropagation()}> + cms.reload()} onError={toast.err} /> +
{inr(o.outstandingPaise)}
))} -
Advance on account - {formatINR(ledger.data.advancePaise)}
)} diff --git a/apps/hq-web/src/pages/client-forms.tsx b/apps/hq-web/src/pages/client-forms.tsx index a092b05..693b3c0 100644 --- a/apps/hq-web/src/pages/client-forms.tsx +++ b/apps/hq-web/src/pages/client-forms.tsx @@ -284,25 +284,21 @@ export function InteractionDialog(props: { export function AssignModuleForm(props: { modules: Module[] - onAssign: (moduleId: string, kind: Kind, creds?: { username: string; password: string }) => void + onAssign: (moduleId: string, kind: Kind) => void }) { const [moduleId, setModuleId] = useState('') const mod = props.modules.find((m) => m.id === moduleId) const [kind, setKind] = useState('') - const [username, setUsername] = useState('') - const [password, setPassword] = useState('') - // SMS is a gateway service — its login is required at assign time so the balance pull works. - const needsCreds = mod?.code === 'SMS' - const ready = moduleId !== '' && kind !== '' && (!needsCreds || (username.trim() !== '' && password.trim() !== '')) - const reset = () => { setModuleId(''); setKind(''); setUsername(''); setPassword('') } + const ready = moduleId !== '' && kind !== '' + const reset = () => { setModuleId(''); setKind('') } return (
{mod !== undefined && ( @@ -311,30 +307,20 @@ export function AssignModuleForm(props: { {mod.allowedKinds.map((k) => )} )} - {needsCreds && ( - <> - setUsername(e.target.value)} /> - setPassword(e.target.value)} /> - - )} - {needsCreds && ( - - SMS needs the provider gateway login — username and password are required so the balance can be pulled. - - )} + + Starts the module at "quoted" and opens its onboarding status line. +
) } @@ -355,22 +341,6 @@ export function ClientModuleStatusSelect(props: { ) } -export function RowDate(props: { - cm: ClientModule; field: 'installedOn' | 'completedOn' | 'trainedOn' - onPatched: () => void; onError: (msg: string) => void -}) { - return ( - { - patchClientModule(props.cm.id, { [props.field]: e.target.value !== '' ? e.target.value : null }) - .then(props.onPatched).catch((err: Error) => props.onError(err.message)) - }} - /> - ) -} - /** * Record a payment against the client — amounts entered in rupees, stored in * integer paise via fromRupees. Shared with DocumentView's "Record payment".