Created
August 31, 2016 20:01
-
-
Save jking6884/3eeda121a4fcaa8eb1ae1cf446abeb05 to your computer and use it in GitHub Desktop.
custom adapter
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
import ApplicationAdapter from './application'; | |
export default ApplicationAdapter.extend({ | |
pathForType: function(modelName){ | |
return 'billables/eligible'; | |
} | |
}); |
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
import DS from 'ember-data'; | |
import Ember from 'ember'; | |
export default DS.Model.extend({ | |
amount: DS.attr('number'), | |
expenses: DS.attr('number'), | |
invoiceGroup: DS.attr('string'), | |
services: DS.attr('number'), | |
tmCode: DS.attr('string') | |
}); |
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
import Ember from 'ember'; | |
import Paginate from 'tm3/mixins/table-pager/route'; | |
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin'; | |
import formatMoney from "accounting/format-money"; | |
import moment from 'moment'; | |
import ENV from 'tm3/config/environment'; | |
import getAppUrl from 'ember-common/utils/get-app-url'; | |
import NonRestRouteAction from 'tm3/mixins/crud/non-rest-route-action'; | |
export default Ember.Route.extend(AuthenticatedRouteMixin, Paginate, NonRestRouteAction, { | |
//export default Ember.Route.extend(Paginate, { | |
modelName: 'invoice-batch', | |
queryParams: { | |
matterType: { | |
refreshModel: true | |
}, | |
cutDate: { | |
refreshModel: true | |
} | |
}, | |
//the name of the current controller since I don't know how to auto detect | |
controllerName: 'accounting.billing.create-batch', | |
// ask for additional data to be sideloaded | |
model: function (params) { | |
delete params.selectedMatterType; | |
params.with = 'invoices'; | |
var queryObj = {} | |
if(params.matterType){ | |
queryObj.matter_type = params.matterType; | |
} | |
if(params.cutDate){ | |
queryObj.cut_date = params.cutDate; | |
} | |
return Ember.RSVP.hash({ | |
model: this.store.query('eligible-billable', queryObj), | |
matterTypes: this.store.query('matter-type', {active: 1}) | |
}); | |
}, | |
setupController: function (controller, resolved) { | |
this._super(controller, resolved.model); | |
controller.set('matterTypes', resolved.matterTypes); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment