eHealthAfrica/direct-delivery-dashboard

View on GitHub
src/app/configurations/facilities/list/list.html

Summary

Maintainability
Test Coverage
<hr/>
            <form class="form-inline" role="form">
          <div class="form-group">
            <select
                class="form-control"
                ng-change="configFacilityListCtrl.switchState(configFacilityListCtrl.selectedStateId)"
                ng-model="configFacilityListCtrl.selectedStateId"
                ng-options="state._id as state.name for state in configFacilityListCtrl.states"
                ng-init="configFacilityListCtrl.selectedStateId">
            </select>
          </div>
          <div class="form-group">
            <select
                class="form-control"
                ng-options="lga.name for lga in configFacilityListCtrl.lgas"
                ng-change="configFacilityListCtrl.getFacilities(configFacilityListCtrl.selectedLga._id)"
                ng-model="configFacilityListCtrl.selectedLga"
              ng-init="configFacilityListCtrl.selectedLga">
            </select>
          </div>
        </form>
        <hr/>
        <table role="table" class="table table-bordered table-striped" ng-show="configFacilityListCtrl.facilities.length > 0">
            <tr>
                <th>#</th>
                <th>Name</th>
                <th></th>
            </tr>
            <tr ng-repeat="facility in configFacilityListCtrl.facilities track by $index">
                <td>{{$index + 1}}</td>
                <td>
          <span editable-text="facility.name" e-name="name" e-form="rowform"  e-required>
            {{facility.name}}
          </span>
        </td>
                <td>
          <form editable-form name="rowform"  ng-show="rowform.$visible" class="form-buttons form-inline" onbeforesave="configFacilityListCtrl.save($data, facility)">
            <button type="submit" ng-disabled="rowform.$waiting" class="btn btn-primary">
              save
            </button>
            <button type="button" ng-disabled="rowform.$waiting" ng-click="rowform.$cancel()" class="btn btn-default">
              cancel
            </button>
          </form>
          <div class="buttons" ng-show="!rowform.$visible">
            <button class="btn btn-primary" ng-click="rowform.$show()">edit</button>
            <button class="btn btn-danger" ng-click="configFacilityListCtrl.remove(facility)">del</button>
          </div>
        </td>
      </tr>
        </table>
    <div class="alert alert-info" ng-show="configFacilityListCtrl.facilities.length === 0">
      <i class="fa fa-info-circle"></i> No facilities found.
    </div>