eHealthAfrica/direct-delivery-dashboard

View on GitHub
src/app/planning/allocation/partials/product-presentation.html

Summary

Maintainability
Test Coverage
<div class="panel-body"
     ng-show="daCtrl.hasNoAllocation()">
  <div class="panel-body alert alert-info">
    <i class="fa fa-lg fa-info-circle"></i>
    <span> No allocation found, please set allocation template.</span>
  </div>
</div>

<div class="panel-body" ng-show="daCtrl.hasNoSchedule()">
  <div class="panel-body alert alert-info">
    <i class="fa fa-lg fa-info-circle"></i>
      <span>
        No allocation found, please
        <a ui-sref="planning.manageFacilities({ roundId: daCtrl.deliveryRound._id })">
          <b>Add Facilities</b>
        </a>
      </span>
  </div>
</div>

<div ng-show="daCtrl.hasProducts()">
  <table
      class="table table-condensed table-striped table-bordered">
    <thead>
    <tr>
      <th>#</th>
      <th>Product Type</th>
      <th>Presentation</th>
      <th>Action</th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="pCode in daCtrl.facAllocInfo.productList track by $index">
      <td class="col-sm-1" ng-bind="($index + 1)"></td>
      <td class="col-sm-3" ng-bind="pCode"></td>
      <td class="col-sm-3">
        <span editable-select="daCtrl.productPresentation[pCode]" e-min="0"
              e-class="form-control"
              e-ng-options="presentation._id as presentation.code for presentation in daCtrl.presentations"
              e-name="{{ pCode }}" e-form="presentationForm" e-required>
          {{ daCtrl.productPresentation[pCode]  || '-' }}
        </span>
      </td>
      <td class="col-sm-1">
        <!-- form -->
        <form editable-form name="presentationForm"
              onbeforesave="daCtrl.updatePresentation($data, pCode)"
              ng-show="presentationForm.$visible"
              class="form-buttons form-inline"
              shown="inserted === pCode">
          <button type="submit" ng-disabled="presentationForm.$waiting"
                  class="btn btn-primary">
            <span>Save</span>
          </button>
          <button type="button" ng-disabled="presentationForm.$waiting"
                  ng-click="presentationForm.$cancel()"
                  class="btn btn-default">
            <span>Cancel</span>
          </button>
        </form>
        <div class="buttons" ng-show="!presentationForm.$visible">
          <button class="btn btn-primary" ng-click="presentationForm.$show()">
            <span>Edit</span>
          </button>
        </div>
      </td>
    </tr>
    </tbody>
  </table>
</div>