modules updates
This commit is contained in:
@@ -65,10 +65,12 @@ const ModifierRow: Component<ModifierRowProps> = (props) => {
|
|||||||
value={props.modifier.value}
|
value={props.modifier.value}
|
||||||
onUpdate={(val) => props.onUpdate(props.modifier.id, { value: val })}
|
onUpdate={(val) => props.onUpdate(props.modifier.id, { value: val })}
|
||||||
class="w-20 text-right text-sm border-b border-dashed border-border focus:border-primary outline-none bg-transparent text-primary font-medium"
|
class="w-20 text-right text-sm border-b border-dashed border-border focus:border-primary outline-none bg-transparent text-primary font-medium"
|
||||||
placeholder="0.00"
|
placeholder={props.modifier.moduleId === 'man-hours' ? "Factor" : "0.00"}
|
||||||
/>
|
/>
|
||||||
<Show when={props.modifier.valueType === 'unit' && props.modifier.unitLabel}>
|
<Show when={(props.modifier.valueType === 'unit' && props.modifier.unitLabel) || props.modifier.moduleId === 'man-hours'}>
|
||||||
<span class="text-[10px] font-bold text-primary/60">{props.modifier.unitLabel}</span>
|
<span class="text-[10px] font-bold text-primary/60">
|
||||||
|
{props.modifier.moduleId === 'man-hours' ? 'factor' : props.modifier.unitLabel}
|
||||||
|
</span>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -28,15 +28,15 @@ const TaxModule: ModifierModule = {
|
|||||||
const ManHoursModule: ModifierModule = {
|
const ManHoursModule: ModifierModule = {
|
||||||
id: 'man-hours',
|
id: 'man-hours',
|
||||||
name: 'Man-Hours',
|
name: 'Man-Hours',
|
||||||
description: 'Calculates estimated labor hours. Does not affect monetary total.',
|
description: 'Calculates labor hours by dividing the sub-scope subtotal by a production factor.',
|
||||||
defaultLabel: 'Estimated Hours',
|
defaultLabel: 'Estimated Hours',
|
||||||
defaultValue: 0,
|
defaultValue: 30,
|
||||||
defaultValueType: 'unit',
|
defaultValueType: 'unit',
|
||||||
defaultUnitLabel: 'hrs',
|
defaultUnitLabel: 'factor',
|
||||||
calculate: () => 0,
|
calculate: () => 0,
|
||||||
calculateDisplay: (m, base) => {
|
calculateDisplay: (m, base) => {
|
||||||
if (m.valueType === 'percent') return base * (m.value / 100);
|
const factor = m.value || 1;
|
||||||
return m.value;
|
return base / factor;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user