Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save efjacobson/cb56d86b2d341e0a6b1cda1280f7278c to your computer and use it in GitHub Desktop.
Save efjacobson/cb56d86b2d341e0a6b1cda1280f7278c to your computer and use it in GitHub Desktop.
@model Healswift.Web.Models.ViewModels.ItemViewModel<int>
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_LayoutHealth.cshtml";
}
@section Styles {
<link href="~/assets/css/individual-provider-crud.css" rel="stylesheet" />
<link href="~/assets/css/ng-img-crop.css" rel="stylesheet" />
}
<div class="container">
<div ng-controller="individualProviderController as individual">
<div class="row">
<div class="col-sm-3 page-sidebar">
<aside>
@Html.Partial("Health/_LoggedInNavBar")
</aside>
</div>
<div class="col-sm-9 col-md-9">
<div class="tab-box">
<ul class="nav nav-tabs">
<li ng-class="individual.tabClass(tab)" ng-repeat="tab in individual.tabs">
<a href="{{tab.link}}" ng-click="individual.setSelectedTab(tab)">{{tab.label}}</a>
</li>
</ul>
<div ng-view></div>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-3">
<input class="btn btn-lg"
name="insert"
type="submit"
ng-class="!individual.provider.id ? 'btn-success' : 'btn-warning'"
ng-value="!individual.provider.id ? 'Insert' : 'Update'"
ng-click="!individual.provider.id ? individual.geoCode(individual.insert) : individual.geoCode(individual.update)" />
<input class="btn btn-lg"
name="delete"
type="submit"
value="Delete"
ng-class="!individual.provider.id ? 'hidden' : 'btn-danger'"
ng-click="individual.openModal()" />
</div>
</div>
</div>
</div>
</div>
<script type="text/ng-template" id="/templates/info.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-cloak ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal" name="individual.form">
<fieldset>
<div class="form-group">
<label class="col-sm-3"
for="firstName">
First Name
</label>
<div class="col-sm-7">
<input class="form-control"
name="firstName"
type="text"
placeholder="First Name (Required)"
ng-model="individual.provider.firstName"
required
ng-minlength="2"
ng-maxlength="50">
<span class="error"
ng-cloak
ng-show="individual.form.firstName.$touched &&
individual.form.firstName.$error.required">
First Name is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.firstName.$touched &&
individual.form.firstName.$error.minlength">
First Name must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.firstName.$dirty &&
individual.form.firstName.$error.maxlength">
First Name cannot be longer than 50 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="middleName">
Middle Name
</label>
<div class="col-sm-7">
<input class="form-control"
name="middleName"
type="text"
placeholder="Middle Name (Optional)"
ng-model="individual.provider.middleName"
ng-maxlength="50">
<span class="error"
ng-cloak
ng-show="individual.form.middleName.$dirty &&
individual.form.middleName.$error.maxlength">
Middle Name cannot be longer than 50 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="lastName">
Last Name
</label>
<div class="col-sm-7">
<input class="form-control"
name="lastName"
type="text"
placeholder="Last Name (Required)"
required
ng-model="individual.provider.lastName"
ng-minlength="2"
ng-maxlength="50">
<span class="error"
ng-cloak
ng-show="individual.form.lastName.$touched &&
individual.form.lastName.$error.required">
Last Name is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.lastName.$touched &&
individual.form.lastName.$error.minlength">
Last Name must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.lastName.$dirty &&
individual.form.lastName.$error.maxlength">
Last Name cannot be longer than 50 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3">Gender</label>
<div class="col-sm-7">
<label class="radio-inline" for="radio-male">
<input type="radio"
name="radioGender"
value="M"
ng-model="individual.provider.gender" />
Male
</label>
<label class="radio-inline" for="radio-female">
<input type="radio"
name="radioGender"
value="F"
ng-model="individual.provider.gender" />
Female
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="npi">
NPI
</label>
<div class="col-sm-7">
<input class="form-control"
name="npi"
type="tel"
placeholder="NPI (Required)"
required
ng-model="individual.provider.npi"
ng-minlength="10"
ng-maxlength="10">
<span class="error"
ng-cloak
ng-show="individual.form.npi.$touched &&
individual.form.npi.$error.required">
NPI number is required.
</span>
<span class="error"
ng-cloak
ng-show="(individual.form.npi.$touched && individual.form.npi.$error.minlength) ||
(individual.form.npi.$dirty && individual.form.npi.$error.maxlength)">
NPI number must be 10 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3">
Primary Specialty
</label>
<div class="col-sm-7">
<ui-select name="selectClassification"
theme="bootstrap"
required
ng-model="individual.selectClassification"
ng-change="individual.renderSpecialties()">
<ui-select-match placeholder="Select or search (Required)">{{$select.selected.classification}}</ui-select-match>
<ui-select-choices repeat="item in individual.classifications | filter: $select.search">
<div ng-bind-html="item.classification | highlight: $select.search"></div>
</ui-select>
<span class="error"
ng-cloak
ng-show="individual.form.selectClassification.$touched &&
individual.form.selectClassification.$error.required">
Primary Specialty is required.
</span>
</div>
</div>
<div class="form-group" ng-show="individual.allSpecialties">
<label class="col-sm-3">
Sub-Specialty
</label>
<div class="col-sm-7">
<ui-select ng-model="individual.selectSpecialty"
theme="bootstrap"
name="selectSpecialty"
required>
<ui-select-match placeholder="Select or search Sub-Specialty (Required)">{{$select.selected.specialty}}</ui-select-match>
<ui-select-choices repeat="item in individual.allSpecialties | filter: $select.search">
<div ng-bind-html="item.specialty | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
<span class="error"
ng-cloak
ng-show="individual.form.selectSpecialty.$touched &&
individual.form.selectSpecialty.$error.required">
Sub-Specialty is required.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="primarySpecialtyLicense">
Primary Specialty License #
</label>
<div class="col-sm-7">
<input class="form-control"
name="primaryTaxonomyLicense"
type="text"
placeholder="Primary Specialty License # (Required)"
required
ng-model="individual.provider.primaryTaxonomyLicense"
ng-minlength="2"
ng-maxlength="50">
<span class="error"
ng-cloak
ng-show="individual.form.primaryTaxonomyLicense.$touched &&
individual.form.primaryTaxonomyLicense.$error.required">
Primary Specialty License # is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.primaryTaxonomyLicense.$touched &&
individual.form.primaryTaxonomyLicense.$error.minlength">
Primary Specialty License # must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.primaryTaxonomyLicense.$dirty &&
individual.form.primaryTaxonomyLicense.$error.maxlength">
Primary Specialty License # cannot be longer than 50 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="primarySpecialtyState">
Primary Specialty License State
</label>
<div class="col-sm-7">
<select class="form-control"
name="primaryTaxonomyState"
required
ng-options="state.stateProvinceCode as state.stateProvinceCode for state in individual.states"
ng-model="individual.provider.primaryTaxonomyState">
<option value="" disabled selected>Select Primary Specialty State (Required)</option>
</select>
<span class="error"
ng-cloak
ng-show="individual.form.primaryTaxonomyState.$touched &&
individual.form.primaryTaxonomyState.$error.required">
Primary Taxonomy Specialty State is required.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="addressLine1">
Practice Address Line 1
</label>
<div class="col-sm-7">
<input class="form-control"
name="addressLine1"
type="text"
placeholder="Practice Address Line 1 (Required)"
ng-model="individual.provider.addressLine1"
required
ng-minlength="2"
ng-maxlength="200">
<span class="error"
ng-cloak
ng-show="individual.form.addressLine1.$touched &&
individual.form.addressLine1.$error.required">
Practice Address Line 1 is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.addressLine1.$touched &&
individual.form.addressLine1.$error.minlength">
Practice Address Line 1 must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.addressLine1.$dirty &&
individual.form.addressLine1.$error.maxlength">
Practice Address Line 1 cannot be longer than 200 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="addressLine2">
Practice Address Line 2
</label>
<div class="col-sm-7">
<input class="form-control"
name="addressLine2"
type="text"
placeholder="Practice Address Line 2 (Optional)"
ng-model="individual.provider.addressLine2"
ng-minlength="2"
ng-maxlength="200">
<span class="error"
ng-cloak
ng-show="individual.form.addressLine2.$touched &&
individual.form.addressLine2.$error.minlength">
Practice Address Line 2 must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.addressLine2.$dirty &&
individual.form.addressLine2.$error.maxlength">
Practice Address Line 2 cannot be longer than 200 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="city">
Practice City
</label>
<div class="col-sm-7">
<input class="form-control"
name="city"
type="text"
placeholder="Practice City (Required)"
ng-model="individual.provider.city"
required
ng-minlength="2"
ng-maxlength="100">
<span class="error"
ng-cloak
ng-show="individual.form.city.$touched &&
individual.form.city.$error.required">
Practice City is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.city.$touched &&
individual.form.city.$error.minlength">
Practice City must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.city.$dirty &&
individual.form.city.$error.maxlength">
Practice City cannot be longer than 100 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="stateProvinceId">
Practice State
</label>
<div class="col-sm-7">
<select class="form-control"
name="state"
ng-options="state.id as state.stateProvinceCode for state in individual.states"
ng-model="individual.provider.stateProvinceId"
required>
<option value="" disabled selected>Select Practice State (Required)</option>
</select>
<span class="error"
ng-cloak
ng-show="individual.form.state.$touched &&
individual.form.state.$error.required">
Practice State is required.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="PostalCode">
Practice Postal Code
</label>
<div class="col-sm-7">
<input class="form-control"
name="postalCode"
type="tel"
placeholder="PostalCode (Required)"
ng-model="individual.provider.postalCode"
required
ng-minlength="2"
ng-maxlength="20" />
<span class="error"
ng-cloak
ng-show="individual.form.postalCode.$touched &&
individual.form.postalCode.$error.required">
Practice PostalCode is required.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.postalCode.$touched &&
individual.form.postalCode.$error.minlength">
Practice Postal Code must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.postalCode.$dirty &&
individual.form.postalCode.$error.maxlength">
Practice Postal Code cannot be longer than 20 characters.
</span>
</div>
</div>
<div class="form-group">
<a ng-click="individual.hospitalModal()" class="text-center"><h5><u>Select Hospital(s) that you are affiliated with.</u></h5></a>
<label class="col-sm-3 col-md-3">Hospital Affiliation(s)</label>
<div class="col-sm-7 col-md-7">
<div class="form-control" id="hospitalDisplay" ng-repeat="hospital in individual.provider.hospitals">
{{hospital.hospitalName}}
<button type='button' class='close' ng-click="individual.removeHos(hospital)">&times;</button>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/profilepic.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-cloak ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<div ng-show="!individual.provider.id">
<h3 class="search-error">
You can upload a photo after you insert basic information.
</h3>
</div>
<form class="form-horizontal" name="individual.form" ng-show="individual.provider.id">
<fieldset>
<div class="row">
<img id="profile-photo"
alt="avatar"
ng-cloak
ng-src="{{individual.profilePhotoUrl}}">
<input id="showPhotoUpload"
class="btn btn-lg btn-primary"
ng-value="individual.isPhotoUploadVisible ? 'Hide the Photo Dialog' : 'Upload a Profile Photo'"
ng-class="individual.isPhotoUploadVisible ? 'btn-warning' : 'btn-primary'"
ng-click="individual.showPhotoUpload()"
type="button" />
</div>
<div ng-cloak ng-if="individual.isPhotoUploadVisible">
<div class="row">
<h4 class="text-center pictureHeader">Crop Picture and Upload</h4>
</div>
<div class="row">
<div class="col-md-6">
<button id="picture-select"
class="btn btn-lg btn-success"
ngf-select
ng-model="picFile"
accept="image/*">
Select Picture
</button>
<div ngf-drop
ng-model="picFile"
ngf-pattern="image/*"
class="cropArea">
<img-crop image="picFile | ngfDataUrl"
result-image="croppedDataUrl"
ng-init="croppedDataUrl=''">
</img-crop>
</div>
</div>
<div class="col-md-6">
<div id="cropped-photo-holder">
<h4 class="previewHeader">Profile Photo Preview</h4>
<div>
<img id="cropped-photo"
ng-src="{{croppedDataUrl}}" />
</div>
<button id="picture-submit"
class="btn btn-lg btn-success"
ng-click="upload(croppedDataUrl, picFile.name)">
Submit
</button>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/contact.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal" name="individual.form">
<fieldset>
<div class="form-group">
<label class="col-sm-3">Language(s) Spoken</label>
<ui-select class="col-sm-7"
name="language"
close-on-select="false"
multiple
ng-cloak
ng-model="individual.provider.languages">
<ui-select-match placeholder="Select Language(s)">{{$item.languageName}}</ui-select-match>
<ui-select-choices repeat="item in individual.languages">
<div ng-bind-html="item.languageName"></div>
</ui-select-choices>
</ui-select>
</div>
<div class="form-group">
<label class="col-sm-3"
for="phoneNumber">
Phone Number
</label>
<div class="col-sm-7">
<input class="form-control"
name="phoneNumber"
type="tel"
placeholder="Phone Number"
ng-model="individual.provider.phoneNumber"
ng-minlength="10"
ng-maxlength="20">
<span class="error"
ng-cloak
ng-show="individual.form.phoneNumber.$touched &&
individual.form.phoneNumber.$error.minlength">
Phone Number must be at least 10 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.phoneNumber.$dirty &&
individual.form.phoneNumber.$error.maxlength">
Phone Number cannot be longer than 20 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="phoneNumberText">
Phone Number (Text)
</label>
<div class="col-sm-7">
<input class="form-control"
name="phoneNumberText"
type="tel"
placeholder="Phone Number That Allows Text Messaging (Optional)"
ng-model="individual.provider.phoneNumberText"
ng-minlength="10"
ng-maxlength="20">
<span class="error"
ng-cloak
ng-show="individual.form.phoneNumberText.$touched &&
individual.form.phoneNumberText.$error.minlength">
Phone Number Text must be at least 10 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.phoneNumberText.$dirty &&
individual.form.phoneNumberText.$error.maxlength">
Phone Number Text cannot be longer than 20 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="email">
Email
</label>
<div class="col-sm-7">
<input class="form-control"
name="email"
type="email"
placeholder="Email"
ng-model="individual.provider.email"
ng-maxlength="100">
<span class="error"
ng-cloak
ng-show="individual.form.email.$touched &&
individual.form.email.$error.email">
Please enter a valid email address.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.email.$dirty &&
individual.form.email.$error.maxlength">
Email cannot be longer than 100 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="yelpUrl">
Yelp
</label>
<div class="col-sm-7">
<input class="form-control"
name="yelpUrl"
type="url"
placeholder="Yelp URL"
ng-model="individual.provider.yelpUrl"
ng-minlength="5"
ng-maxlength="200">
<span class="error"
ng-cloak
ng-show="individual.form.yelpUrl.$touched &&
individual.form.yelpUrl.$error.url">
Please enter a valid Yelp URL.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.yelpUrl.$touched &&
individual.form.yelpUrl.$error.minlength">
Yelp URL must be at least 5 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.yelpUrl.$dirty &&
individual.form.yelpUrl.$error.maxlength">
Yelp URL cannot be longer than 200 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="linkedInUrl">
LinkedIn
</label>
<div class="col-sm-7">
<input class="form-control"
name="linkedInUrl"
type="url"
placeholder="LinkedIn URL"
ng-model="individual.provider.linkedInUrl"
ng-minlength="5"
ng-maxlength="200">
<span class="error"
ng-cloak
ng-show="individual.form.linkedInUrl.$touched &&
individual.form.linkedInUrl.$error.url">
Please enter a valid LinkedIn URL.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.linkedInUrl.$touched &&
individual.form.linkedInUrl.$error.minlength">
LinkedIn URL must be at least 5 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.linkedInUrl.$dirty &&
individual.form.linkedInUrl.$error.maxlength">
LinkedIn URL cannot be longer than 200 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3"
for="personalUrl">
Personal Website
</label>
<div class="col-sm-7">
<input class="form-control"
name="personalUrl"
type="url"
placeholder="Personal Website URL"
ng-model="individual.provider.personalUrl"
ng-minlength="5"
ng-maxlength="200">
<span class="error"
ng-cloak
ng-show="individual.form.personalUrl.$touched &&
individual.form.personalUrl.$error.url">
Please enter a valid Website URL.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.personalUrl.$touched &&
individual.form.personalUrl.$error.minlength">
Personal Website URL must be at least 5 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.personalUrl.$dirty &&
individual.form.personalUrl.$error.maxlength">
Personal Website URL cannot be longer than 200 characters.
</span>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/certification.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal" name="individual.form">
<fieldset>
<div class="form-group">
<label class="col-sm-3">Board Certification(s)</label>
<ui-select class="col-sm-7"
name="abms"
close-on-select="false"
multiple
ng-cloak
ng-model="individual.provider.abms">
<ui-select-match placeholder="Select Board Certification(s)">{{$item.name}}</ui-select-match>
<ui-select-choices repeat="item in individual.abms">
<div ng-bind-html="item.name"></div>
</ui-select-choices>
</ui-select>
</div>
<div ng-controller="medicalSchoolController as medSchoolCtr">
<div class="form-group">
<label class="col-sm-3">Medical School</label>
<div class="col-sm-7">
<select class="form-control"
name="medicalSchoolId"
ng-options="med.id as med.school for med in medSchoolCtr.medicalSchool"
ng-model="individual.provider.medicalSchoolId">
<option value="">Select a Medical School</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3">Degree</label>
<div class="col-sm-7">
<input class="form-control"
type="text"
name="degree"
placeholder="Degree"
ng-model="individual.provider.degree"
ng-minlength="2"
ng-maxlength="50" />
<span class="error"
ng-cloak
ng-show="individual.form.degree.$touched &&
individual.form.degree.$error.minlength">
Degree name must be at least 2 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.degree.$dirty &&
individual.form.degree.$error.maxlength">
Degree name must be no longer than 50 characters.
</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3">Degree Date</label>
<div class="col-sm-7">
<input class="form-control"
type="text"
name="degreeDate"
placeholder="Year Degree Received"
ng-model="individual.provider.degreeDate"
ng-minlength="4"
ng-maxlength="4" />
<span class="error"
ng-cloak
ng-show="individual.form.degreeDate.$touched &&
individual.form.degreeDate.$error.minlength">
Degree Date must only be year (4 characters).
</span>
<span class="error"
ng-cloak
ng-show="individual.form.degreeDate.$dirty &&
individual.form.degreeDate.$error.maxlength">
Degree Date must only be year (4 characters).
</span>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/healthplans.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="col-sm-3">Insurance Carrier: </label>
<ui-select class="col-sm-7"
theme="bootstrap"
name="hplans"
ng-model="individual.selectedCarrier"
ng-change="individual.renderHealthPlansByCarrier(individual.selectedCarrier.id)">
<ui-select-match placeholder="Select Carrier">{{$select.selected.carrierName}}</ui-select-match>
<ui-select-choices repeat="item in individual.allCarriers | filter: $select.search">
<div ng-bind-html="item.carrierName | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
</fieldset>
<fieldset>
<div class="form-group"
ng-show="individual.healthPlans">
<label class="col-sm-3">Health Plan (Optional)</label>
<ui-select class="col-sm-7"
name="hplans"
ng-model="individual.selectedHealthPlan">
<ui-select-match placeholder="Health Plan">{{$select.selected.planName}}</ui-select-match>
<ui-select-choices repeat="item in individual.healthPlans">
<div ng-bind-html="item.planName | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<button class="btn btn-success"
ng-click="individual.pushToHealthPlansArray(individual.selectedCarrier, individual.selectedHealthPlan)">
Add Carrier and Health Plan
</button>
<button class="btn btn-warning" ng-click="individual.clearForm()">Cancel</button>
</div>
</fieldset>
<div class="panel panel-default" ng-show="individual.provider.healthPlans">
<div class="panel-heading">
<h4 class="panel-title">
Health Plan Affiliations
</h4>
</div>
<div class="panel-collapse collapse in"
ng-show="individual.provider.healthPlans">
<div class="panel-body">
<div class="item-list" ng-repeat="item in individual.provider.healthPlans track by $index">
<strong>{{item.carrierName}}</strong> {{item.planName}}
<button type='button' class='close' ng-click="individual.removeHealthPlan(item)">&times;</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/aboutme.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong ng-bind="!individual.provider.id ?
'Create a New Individual Provider' :
'Update Individual Provider'">
</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal" name="individual.form">
<fieldset>
<label class="col-sm-3">About Me</label>
<div class="col-sm-7">
<textarea class="form-control"
id="myBio"
name="myBio"
placeholder="Enter a summary about you here (1000 Characters Max)."
rows="8"
ng-minlength="10"
ng-maxlength="1000"
ng-model="individual.provider.myBio"></textarea>
<span class="error"
ng-cloak
ng-show="individual.form.myBio.$touched &&
individual.form.myBio.$error.minlength">
About Me must be at least 10 characters.
</span>
<span class="error"
ng-cloak
ng-show="individual.form.myBio.$dirty &&
individual.form.myBio.$error.maxlength">
About Me must be no longer than 1000 characters.
</span>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<script type="text/ng-template" id="/templates/records.html">
<div class="inner-box category-content">
<div class="row">
<div class="col-lg-12">
<div class="panel-heading">
<h4 class="title-2 uppercase text-center">
<strong>Public Records</strong>
</h4>
<h5>
<a ng-show="individual.provider.id"
ng-click="individual.viewProfile()">View Profile</a>
</h5>
</div>
<form class="form-horizontal" name="individual.form">
<fieldset>
<div class="col-sm-offset-1" ng-show="individual.noPublicRecordsFound" ng-cloak>
<h3 class="search-error">
No public records were found.
</h3>
</div>
<div class="row" ng-repeat="selectedPublicRecord in individual.publicRecords track by $index" ng-if="$index % 2 == 0">
<div class="col-xs-6"
ng-repeat="i in [$index, $index + 1]"
ng-if="individual.publicRecords[i] != null">
<div class="item-list">
<div class="col-sm-12 add-desc-box">
<div class="add-details">
<div><h4 class="add-title">Date: {{individual.publicRecords[i].date}}</h4></div>
<div>Id: {{individual.publicRecords[i].id}}</div>
<div>Description: {{individual.publicRecords[i].description}}</div>
<div>URL: <a ng-href="{{individual.publicRecords[i].url}}">{{individual.publicRecords[i].url}}</a></div>
<div class="rightward">
@if (User.IsInRole("Admin"))
{<a ng-click="individual.selectPublicRecord(individual.publicRecords[i])"
class="btn btn-sm btn-warning">Edit</a>}
</div>
</div>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</script>
<!-- Delete Confirm Modal-->
<script type="text/ng-template"
id="myModalContent">
<div class="modal-header">
<h4 class="modal-title">Are you sure you want to delete this individual provider?</h4>
</div>
<div class="modal-footer">
<button class="btn btn-danger"
type="button"
ng-click="modalInstanceController.ok()">
Delete
</button>
<button class="btn btn-success"
type="button"
ng-click="modalInstanceController.cancel()">
Cancel
</button>
</div>
</script>
<!-- Modal to search Hospitals and add them to profile-->
<script type="text/ng-template" id="searchHospitalContent.html">
<div class="modal-content">
<div class="modal-header">
<label class="col-md-3 control-label">Hospital</label>
<button type='button' class='close' ng-click="modalHos.cancel()">&times;</button>
</div>
<div class="modal-body">
<form class="form-horizontal" id="search" name="modalHos.search" ng-cloak novalidate>
<fieldset>
@* hospital name *@
@* modalItem is the individual provider with the different properties attached like: modalHos.modalItem.lastName give individual provider last name *@
<div class="form-group">
<label class="col-md-3 control-label">Hospital</label>
<div class="col-md-8">
<input type="text" class="form-control"
placeholder="Hospital Name"
name="name"
id="name"
ng-model="modalHos.newSearch.name">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<button type="submit" ng-click="modalHos.hospitalSearch()" class="btn btn-primary" value="Submit">Search</button>
<button type="button" class="btn btn-info" ng-click="modalHos.clear()">Clear</button>
</div>
</div>
<div class="col-md-12" ng-cloak ng-hide>
<div class="category-list">
<div ng-repeat="hospital in modalHos.hospitals">
<div class="item-list" ng-click="modalHos.hospitalModalSubmit(hospital)">
<div class="add-desc-box">
<div><h4 class="add-title">{{hospital.hospitalName}}</h4></div>
</div>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</script>
<!-- Public Records Modal -->
<script type="text/ng-template" id="publicRecordModal.html">
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' ng-click="mc.cancel()">&times;</button>
<h4 class='modal-title'>Edit Public Record</h4>
</div>
<div class='modal-body'>
<form class="form-horizontal" id="formId" name="mc.modalForm">
<div class="form-group" ng-hide="true">
<label class="col-sm-3control-label">ID:</label>
<div class="col-sm-8">
<input id="id"
ng-model="mc.modalItem.id"
name="id"
placeholder="ID"
class="form-control"
type="text" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3control-label">Individual Providers Id:</label>
<div class="col-sm-8">
<input id="individualProvidersId"
ng-model="mc.modalItem.individualProviderId"
name="IndividualProvidersId"
placeholder="Providers Id"
class="form-control input-md"
required=""
type="text"
disabled />
</div>
</div>
<div class="form-group">
<label class="col-sm-3control-label">Date of Incident:</label>
<div class="col-sm-8">
<input type="date"
id="date"
name="Date"
placeholder="Date"
class="form-control input-md"
required=""
ng-model="mc.modalItem.date" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3control-label">Description of Action Type:</label>
<div class="col-sm-8">
<input id="description"
ng-model="mc.modalItem.description"
name="Description"
placeholder="Please Enter a Description of the Action Type here..."
class="form-control input-md"
required=""
type="text" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3control-label">Link to more information:</label>
<div class="col-sm-8">
<input id="url"
ng-model="mc.modalItem.url"
name="url"
placeholder="Link to more information"
class="form-control"
type="url" />
<span class="help-block" ng-show="mc.modalForm.url.$dirty && mc.modalForm.url.$error.url">Must be a valid URL. e.g. "http://www.google.com"</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3control-label"></label>
<div class="col-sm-8">
<a ng-click="mc.ok()" id="buttonId" class="btn btn-success btn-lg">Submit</a>
<a ng-click="mc.cancel()" class="btn btn-warning btn-lg">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</script>
@section Scripts {
<script src='~/Scripts/healswift.individualproviders.services.js'></script>
<script src='~/Scripts/healswift.addresses.services.js'></script>
<script src='~/Scripts/healswift.taxonomies.services.js'></script>
<script src='~/Scripts/healswift.languages.services.js'></script>
<script src='~/Scripts/healswift.ABMS.services.js'></script>
<script src="~/Scripts/healswift.healthplans.services.js"></script>
<script src="~/Scripts/healswift.medicalschools.services.js"></script>
<script src="~/Scripts/healswift.publicrecords.services.js"></script>
<script src="~/Scripts/healswift.hospitals.services.js"></script>
<script src="~/Scripts/healswift.carriers.services.js"></script>
<script src="~/Scripts/app/services/carriersService.js"></script>
<script src="~/Scripts/app/services/individualProviderService.js"></script>
<script src="~/Scripts/app/services/languagesService.js"></script>
<script type="text/javascript">
healswift.page.providerId = @Html.Raw(Json.Encode(@Model.Item));
healswift.page.googleApiKey = '@Model.GoogleApiKey';
healswift.page.googleApiUrl = 'https://maps.googleapis.com/maps/api/js?key=' + healswift.page.googleApiKey;
</script>
<script type="text/javascript">
//routing for angular tabs
(function () {
"use strict";
angular.module(APPNAME)
.config(["$routeProvider", "$locationProvider",
function ($routeProvider, $locationProvider) {
$routeProvider.when('/', {
templateUrl: '/templates/info.html',
}).when('/profilepic', {
templateUrl: '/templates/profilepic.html'
}).when('/contact', {
templateUrl: '/templates/contact.html'
}).when('/certification', {
templateUrl: '/templates/certification.html'
}).when('/healthplans', {
templateUrl: '/templates/healthplans.html'
}).when('/aboutme', {
templateUrl: '/templates/aboutme.html'
}).when('/records', {
templateUrl: '/templates/records.html'
});
$locationProvider.html5Mode(false);
}])
})();
//AbmsService
(function() {
'use strict';
angular.module(APPNAME)
.factory('$abmsService', AbmsServiceFactory);
AbmsServiceFactory.$inject = ['$baseService', '$healswift'];
function AbmsServiceFactory($baseService, $healswift) {
var abmsServiceObject = healswift.ABMS.services;
var abmsService = $baseService.merge(true, {}, abmsServiceObject, $baseService);
return abmsService;
}
})();
//AddressService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$addressService', AddressServiceFactory);
AddressServiceFactory.$inject = ['$baseService', '$healswift'];
function AddressServiceFactory($baseService, $healswift) {
var addressServiceObject = healswift.addresses.services;
var addressService = $baseService.merge(true, {}, addressServiceObject, $baseService);
return addressService;
}
})();
//IndividualProviderService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$individualProviderService', IndividualProviderServiceFactory);
IndividualProviderServiceFactory.$inject = ['$baseService', '$healswift'];
function IndividualProviderServiceFactory($baseService, $healswift) {
var individualProviderServiceObject = healswift.individualproviders.services;
var individualProviderService = $baseService.merge(true, {}, individualProviderServiceObject, $baseService);
return individualProviderService;
}
})();
//HospitalService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$hospitalsService', HospitalsServiceFactory);
HospitalsServiceFactory.$inject = ['$baseService', '$healswift'];
function HospitalsServiceFactory($baseService, $healswift) {
var hospitalsServiceObject = healswift.hospitals.services;
var newService = $baseService.merge(true, {}, hospitalsServiceObject, $baseService);
return newService;
}
}());
//HealthPlansService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$healthPlansService', HealthPlansServiceFactory);
HealthPlansServiceFactory.$inject = ['$baseService', '$healswift'];
function HealthPlansServiceFactory($baseService, $healswift) {
var healthPlansServiceObject = healswift.healthplans.services;
var healthPlansService = $baseService.merge(true, {}, healthPlansServiceObject, $baseService);
return healthPlansService;
}
})();
//LanguageService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$languageService', LanguageServiceFactory);
LanguageServiceFactory.$inject = ['$baseService', '$healswift'];
function LanguageServiceFactory($baseService, $healswift) {
var languageServiceObject = healswift.languages.services;
var languageService = $baseService.merge(true, {}, languageServiceObject, $baseService);
return languageService;
}
})();
//MedicalSchoolService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$medicalSchoolService', MedicalSchoolServiceFactory);
MedicalSchoolServiceFactory.$inject = ['$baseService', '$healswift'];
function MedicalSchoolServiceFactory($baseService, $healswift) {
var medicalSchoolServiceObject = healswift.medicalschools.services;
var medicalSchoolService = $baseService.merge(true, {}, medicalSchoolServiceObject, $baseService);
return medicalSchoolService;
}
})();
//TaxonomyService
(function () {
'use strict';
angular.module(APPNAME)
.factory('$taxonomyService', TaxonomyServiceFactory);
TaxonomyServiceFactory.$inject = ['$baseService', '$healswift'];
function TaxonomyServiceFactory($baseService, $healswift) {
var taxonomyServiceObject = healswift.taxonomies.services;
var taxonomyService = $baseService.merge(true, {}, taxonomyServiceObject, $baseService);
return taxonomyService;
}
})();
//PublicRecordsService
(function() {
'use strict';
angular.module(APPNAME)
.factory('$publicRecordsService', PublicRecordsServiceFactory);
PublicRecordsServiceFactory.$inject = ['$baseService', '$healswift'];
function PublicRecordsServiceFactory($baseService, $healswift) {
var publicRecordsServiceObject = healswift.publicrecords.services;
var publicRecordsService = $baseService.merge(true, {}, publicRecordsServiceObject, $baseService);
return publicRecordsService;
}
})();
//MedicalSchoolController
(function () {
'use strict';
angular.module(APPNAME)
.controller('medicalSchoolController', MedicalSchoolController);
MedicalSchoolController.$inject = ['$scope', '$medicalSchoolService'];
function MedicalSchoolController($scope, $medicalSchoolService) {
var vm = this;
vm.$medicalSchoolService = $medicalSchoolService;
vm.$scope = $scope;
vm.notify = vm.$medicalSchoolService.getNotifier($scope);
vm.receiveMedicalSchools = _receiveMedicalSchools;
vm.onGetError = _onGetError;
render();
function render() {
vm.$medicalSchoolService.getAll(vm.receiveMedicalSchools, vm.onGetError);
}
function _receiveMedicalSchools(data) {
vm.notify(function () {
vm.medicalSchool = data.items;
});
}
function _onGetError(jqXhr, status, error) {
console.error(jqXhr);
console.error(status);
console.error(error);
}
}
})();
//ModalInstanceController
(function () {
'use strict';
angular.module(APPNAME)
.controller('modalInstanceController', ModalInstanceController);
ModalInstanceController.$inject = ['$scope', '$uibModalInstance'];
function ModalInstanceController(
$scope
, $uibModalInstance) {
var vm = this;
vm.$scope = $scope;
vm.$uibModalInstance = $uibModalInstance;
vm.ok = function () {
vm.$uibModalInstance.close(true);
};
vm.cancel = function () {
vm.$uibModalInstance.close(false);
};
}
})();
//IndividualProviderController
(function () {
'use strict';
angular.module(APPNAME)
.controller('individualProviderController', IndividualProviderController);
IndividualProviderController.$inject = ['$scope'
, '$baseController'
, '$individualProviderService'
, '$languageService'
, '$abmsService'
, '$uibModal'
, '$publicRecordsService'
, '$taxonomyService'
, '$addressService'
, 'Upload'
, '$hospitalsService'
, '$healthPlansService'
, '$carriersService'];
function IndividualProviderController(
$scope
, $baseController
, $individualProviderService
, $languageService
, $abmsService
, $uibModal
, $publicRecordsService
, $taxonomyService
, $addressService
, Upload
, $hospitalsService
, $healthPlansService
, $carriersService) {
var vm = this;
vm.languageIds = [];
vm.abmsIds = [];
vm.healthPlanIds = [];
vm.hospitalIds = [];
vm.healthPlansArray = [];
vm.healthPlansObject = {};
var _googleMapsApiInitialized = false;
vm.noPublicRecordsFound = true;
vm.headingInfo = 'Individual Providers';
vm.profilePhotoUrl = '/images/user.jpg';
vm.provider = {};
vm.states = null;
vm.publicRecords = null;
vm.selectedPublicRecord = null;
vm.modalSelected = null;
vm.selectClassification = null;
vm.classifications = null;
vm.allSpecialties = null;
vm.hospitals = null;
vm.allCarriers = null;
vm.healthPlans = null;
vm.selectedCarrier = null;
vm.selectedHealthPlan = null;
vm.$scope = $scope;
vm.$individualProviderService = $individualProviderService;
vm.$languageService = $languageService;
vm.$abmsService = $abmsService;
vm.$uibModal = $uibModal;
vm.$addressService = $addressService;
vm.$publicRecordsService = $publicRecordsService;
vm.$taxonomyService = $taxonomyService;
vm.$hospitalsService = $hospitalsService;
vm.$healthPlansService = $healthPlansService;
vm.$carriersService = $carriersService;
$baseController.merge(vm, $baseController);
vm.id = vm.$healswift.providerId;
vm.notify = vm.$individualProviderService.getNotifier($scope);
vm.receiveProvider = _receiveProvider;
vm.onError = _onError;
vm.onInsertSuccess = _onInsertSuccess;
vm.returnToList = _returnToList;
vm.viewProfile = _viewProfile;
vm.insert = _insert;
vm.update = _update;
vm.delete = _delete;
vm.openModal = _openModal;
vm.hospitalModal = _hospitalModal;
vm.receiveLanguages = _receiveLanguages;
vm.receiveAbms = _receiveAbms;
vm.geoCode = _geoCode;
vm.receiveStates = _receiveStates;
vm.formatDate = _formatDate;
vm.selectPublicRecord = _selectPublicRecord;
vm.openPublicRecordModal = _openPublicRecordModal;
vm.receiveClassifications = _receiveClassifications;
vm.renderSpecialties = _renderSpecialties;
vm.getSpecialties = _getSpecialties;
vm.showPhotoUpload = _showPhotoUpload;
vm.$scope.upload = _upload;
vm.onSelectAllCarriersSuccess = _onSelectAllCarriersSuccess;
vm.renderHealthPlansByCarrier = _renderHealthPlansByCarrier;
vm.clearForm = _clearForm;
vm.pushToHealthPlansArray = _pushToHealthPlansArray;
vm.removeHealthPlan = _removeHealthPlan;
vm.tabClass = _tabClass;
vm.setSelectedTab = _setSelectedTab;
vm.tabs = [
{ link: '#/', label: 'Info' },
{ link: '#/profilepic', label: 'Profile Photo' },
{ link: '#/contact', label: 'Contact' },
{ link: '#/certification', label: 'Certifications' },
{ link: '#/healthplans', label: 'Healthplans'},
{ link: '#/aboutme', label: 'About Me' },
{ link: '#/records', label: 'Records' }
];
vm.selectedTab = vm.tabs[0];
prepareMapsApi();
function prepareMapsApi() {
if (!_googleMapsApiInitialized)
{
$.ajax({
url: vm.$healswift.googleApiUrl
, dataType: "script"
, success: render
, error: vm.onError
});
}
else {
render();
}
}
function render() {
var _googleMapsApiInitialized = true;
vm.$languageService.getAll(vm.receiveLanguages, vm.onError);
vm.$publicRecordsService.individualProvidersGetById(vm.id, _onPublicRecordsSuccess, _onPublicRecordsError);
vm.$carriersService.selectAll(_onSelectAllCarriersSuccess, _onSelectAllCarriersError);
}
// _showPhotoUpload
function _showPhotoUpload() {
vm.isPhotoUploadVisible = !vm.isPhotoUploadVisible;
}
// _upload
function _upload(dataUrl, name) {
Upload.upload({
url: "/api/Files/uploadindividualproviderphoto/" + vm.provider.id,
data: {
file: Upload.dataUrltoBlob(dataUrl, name)
},
}).then(function() {
_getIndividualProviderPhotoKey(vm.provider.id);
});
}
// _getIndividualProviderPhotoKey
function _getIndividualProviderPhotoKey(id) {
var url = "/api/Files/getindividualproviderphoto/" + id;
var settings = {
cache: false
, dataType: "json"
, success: function(res){
vm.notify(function () { //notify controller that model is about to be changed
vm.profilePhotoUrl = res.item;
});
}
, type: "GET"
};
$.ajax(url, settings);
}
function _onPublicRecordsSuccess(data) {
if (data.items == null) {
vm.noPublicRecordsFound = true;
}
else {
vm.noPublicRecordsFound = false;
vm.notify(function() {
vm.publicRecords = data.items;
});
_formatDate(vm.publicRecords);
}
}
function _onPublicRecordsError(jqXhr, status, error) {
console.log(error);
}
//Start of the dropdowns
function _receiveLanguages(data) {
vm.notify(function () {
vm.languages = data.items;
});
vm.$abmsService.getAll(vm.receiveAbms, vm.onError);
}
function _receiveAbms(data) {
vm.notify(function() {
vm.abms = data.items;
});
vm.$addressService.countryIdSelectAll(vm.receiveStates, vm.onError);
}
function _receiveStates(data) {
vm.notify(function () {
vm.states = data.items;
});
vm.$taxonomyService.getAllClassifications(vm.receiveClassifications, vm.onError);
}
function _receiveClassifications(data) {
vm.notify(function () {
vm.classifications = data.items;
});
if (vm.id) {
vm.$individualProviderService.selectById(
vm.id
, vm.receiveProvider
, vm.onError);
}
}
function _formatDate(data){
var monthsList = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
for (var index = 0; index < data.length; index++) {
var current = data[index];
var year = current.date.substring(0, 4);
var month = current.date.substring(5, 7);
var day = current.date.substring(8, 10);
var monthIndex = parseInt(month) - 1;
var newDate = monthsList[monthIndex] + " " + day + ", " + year;
current.date = newDate;
};
}
function _selectPublicRecord(aPublicRecord) {
vm.$publicRecordsService.getById(aPublicRecord.id, _onGetAPublicRecordSuccess, _onGetAPublicRecordError);
}
function _onGetAPublicRecordSuccess(data) {
vm.notify(function () {
vm.selectedPublicRecord = data.item;
});
vm.selectedPublicRecord.date = new Date(vm.selectedPublicRecord.date);
_openPublicRecordModal(vm.selectedPublicRecord);
}
function _onGetAPublicRecordError(jqXhr, status, error) {
console.log(error);
}
function _receiveProvider(data) {
vm.notify(function () {
vm.provider = data.item;
});
_getIndividualProviderPhotoKey(vm.provider.id);
vm.selectClassification = {};
vm.selectClassification.classification = vm.provider.classification;
vm.renderSpecialties();
}
function _renderSpecialties() {
if (vm.selectClassification) {
vm.$taxonomyService.getSpecialties(vm.selectClassification.classification, vm.getSpecialties, vm.onError);
}
if (!vm.provider.specialization) {
vm.selectSpecialty = {};
vm.selectSpecialty.specialty = "General";
console.log("General");
}
if (vm.provider.specialization) {
vm.selectSpecialty = {};
vm.selectSpecialty.specialty = vm.provider.specialization;
}
}
function _getSpecialties(data) {
vm.notify(function () {
vm.allSpecialties = data.item;
});
}
function _mapMultipleSelectArrays() {
if (vm.provider.languages){
vm.provider.languageIds = vm.provider.languages.map(function (obj) {
return obj.id;
})
}
if (vm.provider.abms) {
vm.provider.abmsIds = vm.provider.abms.map(function (obj) {
return obj.id;
})
}
if (vm.provider.healthPlans) {
vm.provider.healthPlanIds = vm.provider.healthPlans.map(function (obj) {
var newObject = {};
if (obj.carrierId){
newObject.carrierId = obj.carrierId;
newObject.healthPlanId = obj.id;
} else {
newObject.carrierId = obj.id;
newObject.healthPlanId = null;
}
return newObject;
});
}
if (vm.provider.hospitals){
vm.provider.hospitalIds = vm.provider.hospitals.map(function(obj){
return obj.id;
})
}
}
function _getStateCodeById() {
for (var i = 0; i < vm.states.length; i++) {
if (vm.states[i].id == vm.provider.stateProvinceId) {
return vm.states[i].stateProvinceCode;
}
}
}
function _getTaxonomyCodeBySpecialty() {
for (var i = 0; i < vm.allSpecialties.length; i++) {
if (vm.allSpecialties[i].specialty == vm.selectSpecialty.specialty) {
return vm.allSpecialties[i].code;
}
}
}
function _geoCode(onFinish) {
_googleMapsApiInitialized = true; //set initialized flag
vm.provider.stateProvinceCode = _getStateCodeById();
var _geocoder = new google.maps.Geocoder();
var _address = vm.provider.addressLine1 + " "
+ vm.provider.city + " "
+ vm.provider.stateProvinceCode + " "
+ vm.provider.postalCode.substring(0,5);
_geocoder.geocode({ 'address': _address }, function (results, status) {
if (results[0]) {
vm.provider.location = {};
vm.provider.latitude = results[0].geometry.location.lat();
vm.provider.location.lat = vm.provider.latitude;
vm.provider.longitude = results[0].geometry.location.lng();
vm.provider.location.lon = vm.provider.longitude;
onFinish();
}
else {
vm.$alertService.info('Sorry, we weren\'t able to locate that address. Please try again ');
}
});
}
function _onGeocodeError() {
console.log('An error ocurred while geocoding');
}
//temporarily commented out until validation is figured out
function _insert() {
//if (vm.form.$valid) {
vm.provider.primaryTaxonomyCode = _getTaxonomyCodeBySpecialty();
_mapMultipleSelectArrays();
vm.$individualProviderService.insert(
vm.provider
, vm.onInsertSuccess
, vm.onError);
//}
//else {
// vm.$alertService.error('Insert failed: please fill out all required form fields.');
//}
}
function _onInsertSuccess(data) {
vm.notify(function () {
vm.provider.id = data.item;
});
vm.$alertService.success('Insert successful.')
vm.$individualProviderService.setAccurateLocation(vm.provider, console.log("accurate location set"), vm.onError);
vm.provider.isLocationAccurate = 1;
vm.provider.relevance = 0;
vm.$individualProviderService.reIndexElastic(vm.provider, console.log("reindexed"), vm.onError);
}
function _update() {
//if (vm.form.$valid) {
vm.provider.primaryTaxonomyCode = _getTaxonomyCodeBySpecialty();
_mapMultipleSelectArrays();
vm.$individualProviderService.update(
vm.provider
, vm.provider.id
, vm.$alertService.success('Update successful.')
, vm.onError);
vm.$individualProviderService.setAccurateLocation(vm.provider, console.log("accurate location set"), vm.onError);
vm.provider.location = {};
vm.provider.location.lat = vm.provider.latitude;
vm.provider.location.lon = vm.provider.longitude;
vm.provider.isLocationAccurate = 1;
vm.provider.relevance = 0;
vm.$individualProviderService.reIndexElastic(vm.provider, console.log("reindexed"), vm.onError);
//}
//else {
// vm.$alertService.error('Update failed: please fill out all required form fields.');
//}
}
function _delete() {
vm.$individualProviderService.delete(
vm.provider.id
, _onDeleteSuccess
, vm.onError);
}
function _onDeleteSuccess() {
vm.$alertService.success('Delete successful.');
vm.provider = null;
vm.form.$setPristine();
vm.form.$setUntouched();
}
function _openModal() {
var modalInstance = vm.$uibModal.open({
templateUrl: 'myModalContent'
, controller: 'modalInstanceController as modalInstanceController'
});
modalInstance.result.then(function (deleteConfirmed) {
if (deleteConfirmed) {
vm.delete();
}
});
}
function _hospitalModal(){
var modalInstance = vm.$uibModal.open({
animation: true,
templateUrl: 'searchHospitalContent.html',
controller: 'modalController as modalHos',
resolve: { // anything passed to resolve can be injected into the modal controller as shown below
item: function () {
return vm.provider;
}
}
});
modalInstance.result.then(function (selectedItem){
if(vm.provider.hospitals == null){
vm.provider.hospitals = [];
vm.provider.hospitals.push(selectedItem);
}
else{
vm.provider.hospitals.push(selectedItem);
}
});
}
vm.removeHos = function(hospital) {
var index = vm.provider.hospitals.indexOf(hospital);
vm.provider.hospitals.splice(index, 1);
}
function _openPublicRecordModal(aPublicRecord) {
var modalInstance = vm.$uibModal.open({
animation: true,
templateUrl: 'publicRecordModal.html', // this tells it what html template to use. it must exist in a script tag OR external file
controller: 'modalController as mc', // this controller must exist and be registered with angular for this to work
//size: 'sm',
resolve: { // anything passed to resolve can be injected into the modal controller as shown below
item: function () {
return aPublicRecord;
}
}
});
// when the modal closes it returns a promise
modalInstance.result.then(function (selectedItem) {
vm.modalSelected = selectedItem; // if the user closed the modal by clicking Save
vm.$publicRecordsService.update(vm.modalSelected, vm.modalSelected.id, _onPublicRecordUpdateSuccess, _onPublicRecordUpdateError);
});
}
function _onPublicRecordUpdateSuccess (data, status, xhr) {
vm.$publicRecordsService.individualProvidersGetById(vm.id, _onPublicRecordsSuccess, _onPublicRecordsError);
}
function _onPublicRecordUpdateError (xjXhr, status, error) {
console.log(error);
}
function _returnToList() {
window.history.back();
}
function _viewProfile() {
window.location.href = "/individualproviders/" + vm.provider.id;
}
function _onError(jqXhr, status, error) {
console.error(jqXhr);
console.error(status);
console.error(error);
}
//Health Plans Functions
function _clearForm() {
vm.selectedCarrier = null;
vm.selectedHealthPlan = null;
vm.healthPlans = null;
}
function _pushToHealthPlansArray (carrier, healthPlan) {
if (!vm.provider.healthPlans){
vm.provider.healthPlans = [];
}
if (healthPlan == null){
vm.healthPlansObject = carrier;
} else {
vm.healthPlansObject = healthPlan;
}
vm.provider.healthPlans.push(vm.healthPlansObject);
vm.healthPlansObject = {};
_clearForm();
}
function _removeHealthPlan (healthPlan) {
var healthPlanIndex = vm.provider.healthPlans.indexOf(healthPlan);
vm.provider.healthPlans.splice(healthPlanIndex, 1);
}
// Health Plans Ajax
function _renderHealthPlansByCarrier(aCarrierId) {
vm.$healthPlansService.getByProvider(aCarrierId, _onGetByProviderSuccess, _onGetByProviderError)
}
// Health Plans Success
function _onGetByProviderSuccess (data) {
vm.notify(function () {
vm.healthPlans = data.items;
});
}
function _onSelectAllCarriersSuccess (data) {
vm.notify(function () {
vm.allCarriers = data.items;
});
}
// Health Plans Error
function _onSelectAllCarriersError (jqXhr, status, error) {
console.log(error);
}
function _onGetByProviderError (jqXhr, status, error) {
console.log(error);
}
//TABS
function _tabClass(tab) {
if (vm.selectedTab == tab) {
return "active";
} else {
return "";
}
}
function _setSelectedTab(tab) {
console.log("set selected tab", tab);
vm.selectedTab = tab;
}
}
})();
//modal controller
(function () {
"use strict";
angular.module(APPNAME)
.controller('modalController', ModalController);
ModalController.$inject = ['$scope', '$baseController', '$uibModalInstance', 'item', '$hospitalsService']
function ModalController(
$scope
, $baseController
, $uibModalInstance
, item
, $hospitalsService) {
var vm = this;
$baseController.merge(vm, $baseController);
vm.$scope = $scope;
vm.$uibModalInstance = $uibModalInstance;
vm.$hospitalsService = $hospitalsService;
vm.newSearch = {};
vm.hospitals = {};
vm.notify = vm.$hospitalsService.getNotifier($scope);
vm.modalItem = item;
vm.selected = {
item: vm.modalItem
};
vm.modalForm = null;
vm.hospitalSearch = _hospitalSearch;
function _hospitalSearch() {
if (!vm.newSearch.name){
vm.newSearch.name = '';
}
vm.$hospitalsService.hospitalsSearch(vm.newSearch, _successHospitalsSearch, _errorHospitalsSearch);
}
function _successHospitalsSearch(data, status, xhr) {
vm.notify(function () {
vm.hospitals = data.items.filter(filterExistingHospitals);
})
}
function filterExistingHospitals(hospital){
if(vm.modalItem.hospitals != null){
for(var i = 0; i < vm.modalItem.hospitals.length; i++){
if(vm.modalItem.hospitals[i].id === hospital.id){
return false;
}
}
}
return true;
}
function _errorHospitalsSearch(jqXhr, status, error) {
vm.$alertService.error("Hospital Get Error Occured");
}
vm.hospitalModalSubmit = function(hospital){
vm.$uibModalInstance.close(hospital);
};
vm.ok = function () {
vm.$uibModalInstance.close(vm.selected.item);
};
vm.clear = function(){
vm.newSearch.name = '';
vm.hospitals = '';
};
vm.cancel = function () {
vm.$uibModalInstance.dismiss('cancel');
};
}
})();
//MedicalSchoolController
(function () {
'use strict';
angular.module(APPNAME)
.controller('medicalSchoolController', MedicalSchoolController);
MedicalSchoolController.$inject = ['$scope', '$medicalSchoolService'];
function MedicalSchoolController($scope, $medicalSchoolService) {
var vm = this;
vm.$medicalSchoolService = $medicalSchoolService;
vm.$scope = $scope;
vm.notify = vm.$medicalSchoolService.getNotifier($scope);
vm.receiveMedicalSchools = _receiveMedicalSchools;
vm.onGetError = _onGetError;
render();
function render() {
vm.$medicalSchoolService.getAll(vm.receiveMedicalSchools, vm.onGetError);
}
function _receiveMedicalSchools(data) {
vm.notify(function () {
vm.medicalSchool = data.items;
});
}
function _onGetError(jqXhr, status, error) {
console.error(jqXhr);
console.error(status);
console.error(error);
}
}
})();
</script>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment