<div class="card-header d-flex align-items-center" data-bs-toggle="collapse" data-bs-target="#widget_downstream" aria-expanded="false" aria-controls="widget_downstream">
<h5 class="card-title text-capitalize fs-5 me-auto">{{ 'downstream operations'|translate }}</h5>
<span class="fa fa-arrows align-middle w-auto widget-handle"></span>
</div>
<div data-ng-class="['card-body', 'collapse', {'show': !$parent.widget[1]['collapsed']}]" id="widget_downstream">
<table class="table table-sm table-hover table-borderless"><thead><tr>
<td><b class="text-capitalize">{{ 'level'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'reference'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'type'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'operation'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'status'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'item'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'location'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'start date'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'end date'|translate }}</b></td>
<td><b class="text-capitalize">{{ 'quantity'|translate }}</b></td>
</tr></thead>
<tbody>
<tr data-ng-if="!operationplan.downstreamoperationplans"><td colspan="8">{{ 'no downstream information'|translate }}</td></tr>
<tr data-ng-if="operationplan.downstreamoperationplans && peg[11] != 2" data-ng-repeat="peg in operationplan.downstreamoperationplans track by $index">
<td>
<span data-ng-if="peg[11] == 0" class="fa fa-fw fa-caret-right" data-ng-click='expandOrCollapse($index)'></span>
<span data-ng-if="peg[11] == 1" class="fa fa-fw fa-caret-down" data-ng-click='expandOrCollapse($index)'></span>
<span data-ng-if="peg[11] == 3" class="fa fa-fw fa-circle-thin"></span>
&nbsp;{{peg[0]}}</td>

<td data-ng-if="peg[2] == 'MO'">{{peg[1]}}<a data-ng-href="/data/input/manufacturingorder/?noautofilter&parentreference={{peg[1]}}" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="peg[2] == 'WO'">{{peg[1]}}<a data-ng-href="/data/input/workorder/?noautofilter&parentreference={{peg[1]}}" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="peg[2] == 'DO'">{{peg[1]}}<a data-ng-href="/data/input/distributionorder/?noautofilter&parentreference={{peg[1]}}" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="peg[2] == 'PO'">{{peg[1]}}<a data-ng-href="/data/input/purchaseorder/?noautofilter&parentreference={{peg[1]}}" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="peg[2] == 'DLVR'">{{peg[1]}}<a data-ng-href="/data/input/deliveryorder/?noautofilter&parentreference={{peg[1]}}" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="peg[2] == 'STCK'">{{peg[1]}}</td>

<td>{{peg[2]}}</td>

<td data-ng-if="['MO', 'WO'].includes(peg[2])">{{peg[3]}}<a href="/detail/input/operation/key/" role="input/operation" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td data-ng-if="!['MO', 'WO'].includes(peg[2])">{{peg[3]}}</td>
<td>{{peg[4]}}</td>
<td>{{peg[5]}}<a data-ng-if="peg[5]" href="/detail/input/item/key/" role="input/item" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td>{{peg[6]}}<a data-ng-if="peg[6]" href="/detail/input/location/key/" role="input/location" onclick="opendetail(event)">
  <span class="fa fa-caret-right"></span></a></td>
<td>{{peg[7]|formatdatetime}}</td>
<td>{{peg[8]|formatdatetime}}</td>
<td>{{peg[9]|formatnumber}} / {{peg[10]|formatnumber}}</td>
</tr>
</tbody>
</table>
</div>
