eHealthAfrica/direct-delivery-dashboard

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

Summary

Maintainability
Test Coverage
<hr/>
        <div class="clearfix">
            <form class="form form-inline">
                <div class="form-group">
                    <label>Select State</label>
                    <select class="form-control" ng-model="facilityUploadCtrl.state" ng-change="facilityUploadCtrl.changeState()"
                                    ng-options="state._id as state.name for state in facilityUploadCtrl.states">
                    </select>
                </div>

                <div class="form-group ">
                    <ng-csv-import
              content="facilityUploadCtrl.csv.content"
              header="facilityUploadCtrl.csv.header"
              separator="facilityUploadCtrl.csv.separator"
              finished="facilityUploadCtrl.finished(facilityUploadCtrl.csv.result)"
              result="facilityUploadCtrl.csv.result">
            </ng-csv-import>
                </div>
                <button
          class="btn btn-success pull-right btn-lg"
          ng-disabled="facilityUploadCtrl.dataToSave.length === 0"
          ng-click="facilityUploadCtrl.save()">
                    <i class="fa fa-check"></i>
                    Upload <span ng-show="facilityUploadCtrl.dataToSave.length > 0">{{facilityUploadCtrl.dataToSave.length}} facilities</span>
                </button>
            </form>
        </div>
<hr/>
<div class="alert alert-warning" ng-show="facilityUploadCtrl.invalidUploads">
  <i class="fa fa-warning"></i> Facilities highlighted in red background cannot be uploaded due to missing parent locations
</div>

<div class="alert alert-info" ng-show="(!facilityUploadCtrl.dataToSave.length && facilityUploadCtrl.csv.result.length)">
    <i class="fa fa-warning"></i> No valid data to save.
</div>

<div ng-if="facilityUploadCtrl.csv.result.length">
    <table class="table table-bordered table-hover table-condensed">
        <tr style="font-weight: bold">
            <th style="">State</th>
            <th style="">Zone</th>
            <th style="">Lga</th>
            <th style="">Ward</th>
            <th style="">Name</th>
            <th style="">Contact Person</th>
            <th style="">Contact Phones</th>
            <th style="">Contact eMails</th>
        </tr>
        <tr ng-repeat="facility in facilityUploadCtrl.csv.result track by $index" ng-class="{'bg-danger': facility.error}">
            <td ng-bind="facility.statename"></td>
            <td ng-bind="facility.zone"></td>
            <td ng-bind="facility.lganame"></td>
            <td ng-bind="facility.wardname"></td>
            <td ng-bind="facility.primary_name"></td>
            <td>
                    {{facility.first_contact_name}}
            </td>
            <td>
                    {{facility.first_contact_kanoconnect_phone}}
            </td>
            <td>
                    {{facility.first_contact_kanoconnect_email_address}}
            </td>
        </tr>
    </table>
</div>