add disabled state to panels

This commit is contained in:
Matthias Mair 2024-04-16 22:01:19 +02:00
parent 2b5e2867a8
commit 84c52847e9
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A

View File

@ -61,6 +61,9 @@ export default function PartPricingPanel({ part }: { part: any }) {
label="purchase" label="purchase"
title={t`Purchase History`} title={t`Purchase History`}
visible={purchaseOrderPricing} visible={purchaseOrderPricing}
disabled={
!pricing?.purchase_cost_min || !pricing?.purchase_cost_max
}
/> />
<PricingPanel <PricingPanel
content={ content={
@ -72,24 +75,32 @@ export default function PartPricingPanel({ part }: { part: any }) {
label="internal" label="internal"
title={t`Internal Pricing`} title={t`Internal Pricing`}
visible={internalPricing} visible={internalPricing}
disabled={
!pricing?.internal_cost_min || !pricing?.internal_cost_max
}
/> />
<PricingPanel <PricingPanel
content={<SupplierPricingPanel part={part} />} content={<SupplierPricingPanel part={part} />}
label="supplier" label="supplier"
title={t`Supplier Pricing`} title={t`Supplier Pricing`}
visible={purchaseOrderPricing} visible={purchaseOrderPricing}
disabled={
!pricing?.supplier_price_min || !pricing?.supplier_price_max
}
/> />
<PricingPanel <PricingPanel
content={<BomPricingPanel part={part} pricing={pricing} />} content={<BomPricingPanel part={part} pricing={pricing} />}
label="bom" label="bom"
title={t`BOM Pricing`} title={t`BOM Pricing`}
visible={part?.assembly} visible={part?.assembly}
disabled={!pricing?.bom_cost_min || !pricing?.bom_cost_max}
/> />
<PricingPanel <PricingPanel
content={<VariantPricingPanel part={part} pricing={pricing} />} content={<VariantPricingPanel part={part} pricing={pricing} />}
label="variant" label="variant"
title={t`Variant Pricing`} title={t`Variant Pricing`}
visible={part?.is_template} visible={part?.is_template}
disabled={!pricing?.variant_cost_min || !pricing?.variant_cost_max}
/> />
<PricingPanel <PricingPanel
content={ content={
@ -101,12 +112,14 @@ export default function PartPricingPanel({ part }: { part: any }) {
label="sale-pricing" label="sale-pricing"
title={t`Sale Pricing`} title={t`Sale Pricing`}
visible={salesOrderPricing} visible={salesOrderPricing}
disabled={!pricing?.sale_price_min || !pricing?.sale_price_max}
/> />
<PricingPanel <PricingPanel
content={<SaleHistoryPanel part={part} />} content={<SaleHistoryPanel part={part} />}
label="sale-history" label="sale-history"
title={t`Sale History`} title={t`Sale History`}
visible={salesOrderPricing} visible={salesOrderPricing}
disabled={!pricing?.sale_history_min || !pricing?.sale_history_max}
/> />
</Accordion> </Accordion>
)} )}