Skip to content

Commit

Permalink
Merge pull request #125 from JScearcy/master
Browse files Browse the repository at this point in the history
Closes #13 ID Checklist
  • Loading branch information
rockfordlhotka committed Apr 14, 2016
2 parents 7563e1f + 7a413c4 commit 9dd3383
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 6 deletions.
57 changes: 57 additions & 0 deletions src/MCM.KidsIdApp/www/scripts/Controllers/IdChecklistController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// <reference path="../Definitions/angular.d.ts" />
/// <reference path="../Definitions/angular-ui-router.d.ts" />
/// <reference path="../Services/UserService.ts" />
/// <reference path="../Services/DocumentService.ts" />

module MCM {
export class IdChecklistController {
private _state: any;
private _childId: string;
public checkList: PreparationChecklist;

public static $inject = ['$state', '$stateParams','childDataService'];

constructor($state: any, $stateParams: any, private _childDataService: MCM.ChildDataService) {
this._state = $state;
if($stateParams.childId) {
this._childId = $stateParams.childId;
this._childDataService.getById(this._childId).then((child) => {
if(child.checklist) {
this.checkList = child.checklist;
} else {
this.checkList = {
childPhoto: false,
birthCertificate: false,
socialSecurityCard: false,
physicalDetails: false,
distinguishingFeatures: false,
friends: false,
dna: false,
mementos: false,
divorceCustodyPapers: false,
otherParentsAndFamily: false,
}
}
});
}
}

public NavigateToPreviousView() {
this._state.go("childProfileItem", { childId: this._childId });
}

public NavigateToDocuments() {
this._state.go("documents", {childId: this._childId});
}

public SaveCheckList() {
this._childDataService.getById(this._childId).then((child) => {
child.checklist = this.checkList;
this._childDataService.update(child);
});
}

}
}

angular.module("mcmapp").controller("idChecklistController", MCM.IdChecklistController);
8 changes: 7 additions & 1 deletion src/MCM.KidsIdApp/www/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var app = angular.module('mcmapp', ['ionic', 'ionic-datepicker'])
app.factory('storageService', function ($window, $injector) {
//Could also have used a provider for this instead of a factory, but then we can't use the $injector
// for instantiating the storage service implementation which is annoying.
if ($window.tinyHippos) {
if ($window.tinyHippos || !window.cordova) {
console.log("Detected Ripple emulator. Using InMemoryStorageService instead of FileStorageService.");
return $injector.get('inMemoryStorageService');
} else {
Expand Down Expand Up @@ -116,6 +116,12 @@ app.config(function ($stateProvider, $urlRouterProvider) {
templateUrl: 'templates/photos.html',
controller: 'photosController'
})

.state('idChecklist', {
url: 'idchecklist/:childId',
templateUrl: 'templates/idchecklist.html',
controller: 'idChecklistController'
})

.state('physicalDetails', {
url: '/physicalDetails/:childId',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ module MCM {
new NavigationLink("dentalInfo", "Dental Info", "ion-android-happy", "ion-chevron-right"),
new NavigationLink("medicalAlertInfo", "Medical Alert Info", "ion-medkit", "ion-chevron-right"),
new NavigationLink("distinguishingFeatures", "Distinguishing Features", "ion-ios-body", "ion-chevron-right"),
new NavigationLink("idChecklist", "I.D. Checklist", "ion-checkmark", "ion-chevron-right")
new NavigationLink("idChecklist", "I.D. Checklist", "ion-checkmark", "ion-chevron-right"),
new NavigationLink("documents", "Documents", "ion-ios-box", "ion-chevron-right")
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/MCM.KidsIdApp/www/scripts/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ interface ChildDetails {

interface Child {
id: string
childDetails : ChildDetails
childDetails: ChildDetails
physicalDetails?: PhysicalDetails
distinguishingFeatures?: Array<DistinguishingFeature>
distinguishingFeatures?: Array<DistinguishingFeature>
professionalCareProviders?: Array<CareProvider>
familyMembers?: Array<FamilyMember>
friends?: Array<Person>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module MCM {

getDefaultApplicationData(): ApplicationData {
throw "getDefaultApplicationData not implemented.";
return <ApplicationData>{ };
//return <ApplicationData>{ };
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/MCM.KidsIdApp/www/templates/childprofilelist.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="list">
<a class="item item-icon-right" href="#" ng-repeat="chld in cplc.children track by $index">
<!-- Make the name element display block style so it fills the space and makes it easier to click.-->
<i style="display:block" ng-click="cplc.editChild(chld)">{{chld.givenName}}</i>
<i style="display:block" ng-click="cplc.editChild(chld)">{{chld.childDetails.givenName}}</i>
<i class="icon ion-close assertive" ng-click="cplc.removeChild(chld)"></i>
</a>
</div>
Expand Down
28 changes: 28 additions & 0 deletions src/MCM.KidsIdApp/www/templates/idchecklist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<ion-view view-title="Missing Children Minnesota">
<ion-content>
<div ng-controller="idChecklistController as iDC">
<button class="button icon-left ion-chevron-left button-block button-positive" ng-click="iDC.NavigateToPreviousView()">
ID Checklist
</button>
<ion-list>
<ion-checkbox ng-model="iDC.checkList.childPhoto">Photo</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.birthCertificate">Birth Certificate</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.socialSecurityCard">Social Security Card</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.physicalDetails">Description Details</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.distinguishingFeatures">Distinguishing Features</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.friends">Friends</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.dna">DNA</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.mementos">Mementos</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.divorceCustodyPapers">Divorce or Custody Papers</ion-checkbox>
<ion-checkbox ng-model="iDC.checkList.otherParentsAndFamily">Other Relative Info</ion-checkbox>

<button class="button button-block button-positive" ng-click="iDC.SaveCheckList()">
Save
</button>
<button class="button button-block button-positive" ng-click="iDC.NavigateToDocuments()">
Go To Documents
</button>
</ion-list>
</div>
</ion-content>
</ion-view>

0 comments on commit 9dd3383

Please sign in to comment.