-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick Williams
committed
Aug 26, 2015
1 parent
c8953b4
commit ec822e4
Showing
6 changed files
with
196 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<md-content layout-padding layout="column"> | ||
<div layout="column"> | ||
<md-autocomplete flex | ||
ng-required="true" | ||
ng-disabled="false" | ||
md-no-cache="true" | ||
md-selected-item="selectedItem" | ||
md-search-text-change="searchTextChange(searchText)" | ||
md-search-text="searchText" | ||
md-selected-item-change="selectedDistrictChange(item)" | ||
md-items="item in queryDistrictSearch(searchText)" | ||
md-item-text="item.di_extension_name+(item.di_district_name == ''? '' : ' - ')+item.di_district_name" | ||
md-min-length="3" | ||
placeholder="Please Enter the District or Extension Name"> | ||
<md-item-template> | ||
<span md-highlight-text="searchText" md-highlight-flags="^i">{{item.di_extension_name}} | ||
{{item.di_district_name == ""? "" : " - " + item.di_district_name}}</span> | ||
</md-item-template> | ||
<md-not-found> | ||
No matches found for "{{searchText}}". | ||
</md-not-found> | ||
</md-autocomplete> | ||
<md-input-container flex> | ||
<label>Farm Name</label> | ||
<input type="text" ng-model="farm.fr_name"> | ||
</md-input-container> | ||
</div> | ||
|
||
|
||
<md-input-container> | ||
<label>Address 1</label> | ||
<input type="text" ng-model="farm.ad_address1"> | ||
</md-input-container> | ||
|
||
|
||
<div layout="row"> | ||
<md-input-container flex> | ||
<label>Address 2</label> | ||
<input type="text" ng-model="farm.ad_address2"> | ||
</md-input-container> | ||
<md-input-container flex> | ||
<label>City</label> | ||
<input type="text" ng-model="farm.ad_city"> | ||
</md-input-container> | ||
</div> | ||
|
||
<md-input-container> | ||
<label>Farm Size (Acres)</label> | ||
<input type="number" ng-model="farm.fr_size"> | ||
</md-input-container> | ||
|
||
<md-input-container layout="row" layout-align="center center"> | ||
<md-button ng-click="cancelAdd()">Cancel</md-button> | ||
<md-button ng-click="updateFarm(0)">Update</md-button> | ||
</md-input-container> | ||
</md-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<md-card-content class="{{newFarm ? 'dark':'white'}}"> | ||
<div layout="row"> | ||
<h3 class="{{newFarm ? 'dark':'white'}}">Farms</h3> | ||
<div flex class="md-actions edge" layout="row" layout-align="end center"> | ||
<md-button ng-click="newFarmLocation()" class="md-fab edge" aria-label="Add New Farm"> | ||
<md-icon class="edge" md-svg-icon="/images/ic_add_24px.svg"></md-icon> | ||
</md-button> | ||
</div> | ||
</div> | ||
<div ng-include="newFarm ? '/partials/farm_new.html':null"> | ||
|
||
</div> | ||
|
||
<div ng-include="editFarm ? '/partials/farm_edit.html':null"> | ||
|
||
</div> | ||
|
||
</md-card-content> | ||
|
||
<md-card-content> | ||
<div class="farmerInfo" layout="column" layout-padding ng-repeat="farm in farmer.fr_farms"> | ||
<div layout-align="space-around start" layout="row" > | ||
<md-icon flex="5" md-svg-icon="/images/ic_location_on_24px.svg"></md-icon> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.fr_name}} | ||
<div class="label">Farm Name</div> | ||
</div> | ||
</div> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.fr_size}} | ||
<div class="label">Farm Size (Acre)</div> | ||
</div> | ||
</div> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.ad_address1}} | ||
<div class="label">Address 1</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div layout-align="space-around start" layout-padding layout="row"> | ||
<span flex="5"></span> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.ad_city}} | ||
<div class="label">City</div> | ||
</div> | ||
</div> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.di_district.di_parish_name}} | ||
<div class="label">Parish</div> | ||
</div> | ||
</div> | ||
<div layout="column" flex> | ||
<div layout-align="start center" layout="column"> | ||
{{farm.di_district.di_extension_name}} - {{farm.di_district.di_district_name}} | ||
<div class="label">Extension - District</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<button ng-click="editFarmLocation(0)">Edit This Farm</button> | ||
|
||
</md-card-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
var model = require('../../models/db'); | ||
var common = require('../common/common'); | ||
var Commodity = model.Commodity; | ||
var Farm = model.Farm; | ||
var Demand = model.Demand; | ||
var Branch = model.Branch; | ||
var Membership = model.Membership; | ||
|
@@ -242,7 +243,7 @@ exports.getCommodities = function(req, res) { | |
*/ | ||
exports.updateFarmById = function(req, res) { | ||
if(common.isAuthenticated(req, res)) { | ||
model.Farm.update({_id: req.params.farm_id}, req.body, function (err, response) { | ||
/*model.Farm.update({_id: req.params.farm_id}, req.body, function (err, response) { | ||
if (err) { | ||
handleDBError(err, res); | ||
} else { | ||
|
@@ -255,6 +256,18 @@ exports.updateFarmById = function(req, res) { | |
} | ||
} | ||
}); | ||
*/ | ||
|
||
Farm.findByIdAndUpdate({_id:req.params.farm_id}, req.body, function (err, changes) { | ||
if (err) { | ||
handleDBError(err, res); | ||
} else { | ||
res.send(changes); | ||
This comment has been minimized.
Sorry, something went wrong.
tremainebuchanan
Collaborator
|
||
} | ||
}); | ||
|
||
console.log(req.body); | ||
|
||
} | ||
}; | ||
|
||
|
1 comment
on commit ec822e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A console.log( )
really should be a debugging statement and removed later.... @nick22891
@nick22891 we can use dialogs here to tell the user the outcome of the update/edit operations.