Merge branch 'main' into feature/sodistoregrid-live-view

This commit is contained in:
Yinyin Liu 2026-05-19 16:24:20 +02:00
commit 2e137cf550
2 changed files with 20 additions and 2 deletions

View File

@ -366,6 +366,16 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
const handleSubmit = () => {
setLoading(true);
setError(false);
if (canEdit && installationDateChecklistId !== null) {
axiosConfig
.put('/UpdateChecklistItem', null, {
params: {
checklistItemId: installationDateChecklistId,
doneAt: installationDate ?? ''
}
})
.catch(() => {});
}
updateInstallation(formValues, props.type);
};
@ -405,6 +415,7 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
const [networkProviders, setNetworkProviders] = useState<string[]>([]);
const [loadingProviders, setLoadingProviders] = useState(false);
const [installationDate, setInstallationDate] = useState<string>('');
const [installationDateChecklistId, setInstallationDateChecklistId] = useState<number | null>(null);
useEffect(() => {
setLoadingProviders(true);
@ -427,9 +438,13 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
(i: { stepNumber?: number }) => i.stepNumber === 10
);
setInstallationDate(step10?.doneAt ?? '');
setInstallationDateChecklistId(step10?.id ?? null);
}
})
.catch(() => setInstallationDate(''));
.catch(() => {
setInstallationDate('');
setInstallationDateChecklistId(null);
});
}, [props.values.id]);
return (
@ -879,10 +894,11 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
label={<FormattedMessage id="installationDate" defaultMessage="Installation Date" />}
type="date"
value={installationDate}
onChange={(e) => setInstallationDate(e.target.value)}
variant="outlined"
fullWidth
InputLabelProps={{ shrink: true }}
inputProps={{ readOnly: true }}
inputProps={{ readOnly: !canEdit }}
/>
</div>

View File

@ -592,6 +592,8 @@ function SodistoreHomeConfigurationV2(props: SodistoreHomeConfigurationProps) {
{clusters.map((_slotCount, clIdx) => {
const clKey = `Cluster${clIdx + 1}`;
const cluster = formValues.devices?.[invKey]?.Clusters?.[clKey];
// Hide clusters with no installed batteries — Information tab is source of truth.
if (cluster?.BatteryCount === 0) return null;
const charge = cluster?.MaxChargingCurrent ?? '';
const discharge = cluster?.MaxDischargingCurrent ?? '';
const setClusterField = (