Skip to content

Commit

Permalink
move readonly from Front-end to back-end and update Framework and Ext…
Browse files Browse the repository at this point in the history
…ensions
  • Loading branch information
olmobrutall committed Sep 15, 2020
1 parent 333d37e commit 01b8371
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Extensions
6 changes: 5 additions & 1 deletion Southwind.Entities/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public OrderEntity()

protected override bool IsPropertyReadonly(PropertyInfo pi)
{
if (pi.Name == nameof(State))
if (pi.Name == nameof(State) ||
pi.Name == nameof(IsLegacy) ||
pi.Name == nameof(OrderDate) ||
pi.Name == nameof(ShippedDate) ||
pi.Name == nameof(CancelationDate))
return true;

if (State == OrderState.Canceled || State == OrderState.Shipped)
Expand Down
10 changes: 5 additions & 5 deletions Southwind.React/App/Southwind/Templates/Order.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export default function Order(p : { ctx: TypeContext<OrderEntity> }){
</div>
<div className="col-sm-6">
<ValueLine ctx={ctx4.subCtx(o => o.shipName)} />
{ctx2.value.isLegacy && < ValueLine ctx={ctx4.subCtx(o => o.isLegacy)} readOnly={true} />}
<ValueLine ctx={ctx4.subCtx(o => o.state)} readOnly={true} valueHtmlAttributes={{ style: { color: stateColor(o.state) } }} />
<ValueLine ctx={ctx4.subCtx(o => o.orderDate)} unitText={ago(o.orderDate)} readOnly={true} />
{ctx2.value.isLegacy && <ValueLine ctx={ctx4.subCtx(o => o.isLegacy)} />}
<ValueLine ctx={ctx4.subCtx(o => o.state)} valueHtmlAttributes={{ style: { color: stateColor(o.state) } }} />
<ValueLine ctx={ctx4.subCtx(o => o.orderDate)} unitText={ago(o.orderDate)} />
<ValueLine ctx={ctx4.subCtx(o => o.requiredDate)} unitText={ago(o.requiredDate)} onChange={() => forceUpdate()} />
<ValueLine ctx={ctx4.subCtx(o => o.shippedDate)} unitText={ago(o.shippedDate)} hideIfNull={true} readOnly={true} />
<ValueLine ctx={ctx4.subCtx(o => o.cancelationDate)} unitText={ago(o.cancelationDate)} hideIfNull={true} readOnly={true} />
<ValueLine ctx={ctx4.subCtx(o => o.shippedDate)} unitText={ago(o.shippedDate)} hideIfNull={true} />
<ValueLine ctx={ctx4.subCtx(o => o.cancelationDate)} unitText={ago(o.cancelationDate)} hideIfNull={true} />
<EntityCombo ctx={ctx4.subCtx(o => o.shipVia)} />
</div>
</div>
Expand Down

0 comments on commit 01b8371

Please sign in to comment.