-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OBPIH-5455 Add filter for GL account #3866
Changes from all commits
38c55b8
66b6289
087dcde
65ef712
00c5525
593b914
a7c2a6f
63a7aa0
0520272
c7ab214
4bcfe1d
84f09c9
3c2f7b3
d890d5d
4cdc4e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2012 Partners In Health. All rights reserved. | ||
* The use and distribution terms for this software are covered by the | ||
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | ||
* which can be found in the file epl-v10.html at the root of this distribution. | ||
* By using this software in any fashion, you are agreeing to be bound by | ||
* the terms of this license. | ||
* You must not remove this notice, or any other, from this software. | ||
**/ | ||
package org.pih.warehouse.api | ||
|
||
import grails.converters.JSON | ||
import org.pih.warehouse.core.GlAccount | ||
|
||
class SelectOptionsApiController { | ||
|
||
GenericApiService genericApiService; | ||
|
||
def glAccountOptions = { | ||
def glAccounts = genericApiService.getList(GlAccount.class.simpleName, [:]).collect { | ||
[id: it.id, label: "${it.code} - ${it.name}"] | ||
} | ||
render([data: glAccounts] as JSON) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { GL_ACCOUNTS_OPTION } from 'api/urls'; | ||
import apiClient from 'utils/apiClient'; | ||
|
||
export default { | ||
getGlAccountOptions: () => apiClient.get(GL_ACCOUNTS_OPTION), | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
const API = '/openboxes/api'; | ||
|
||
// PURCHASE ORDER | ||
export const PURCHASE_ORDER_API = '/openboxes/api/purchaseOrders'; | ||
export const PURCHASE_ORDER_API = `${API}/purchaseOrders`; | ||
export const PURCHASE_ORDER_DELETE = id => `${PURCHASE_ORDER_API}/${id}`; | ||
export const PURCHASE_ORDER_ROLLBACK_ORDER = id => `${PURCHASE_ORDER_API}/${id}/rollback`; | ||
|
||
// STOCK MOVEMENT | ||
export const STOCK_MOVEMENT_API = '/openboxes/api/stockMovements'; | ||
export const STOCK_MOVEMENT_API = `${API}/stockMovements`; | ||
export const STOCK_MOVEMENT_DELETE = id => `${STOCK_MOVEMENT_API}/${id}`; | ||
export const STOCK_MOVEMENT_PENDING_SHIPMENT_ITEMS = `${STOCK_MOVEMENT_API}/pendingRequisitionItems`; | ||
export const STOCK_MOVEMENT_INCOMING_ITEMS = `${STOCK_MOVEMENT_API}/shippedItems`; | ||
|
||
// STOCK TRANSFER | ||
export const STOCK_TRANSFER_API = '/openboxes/api/stockTransfers'; | ||
export const STOCK_TRANSFER_API = `${API}/stockTransfers`; | ||
export const STOCK_TRANSFER_DELETE = id => `${STOCK_TRANSFER_API}/${id}`; | ||
|
||
// INVOICE | ||
export const INVOICE_API = '/openboxes/api/invoices'; | ||
export const INVOICE_API = `${API}/invoices`; | ||
|
||
// PRODUCT | ||
export const PRODUCT_API = '/openboxes/api/products'; | ||
export const PRODUCT_API = `${API}/products`; | ||
|
||
// STOCK LIST | ||
export const STOCKLIST_API = '/openboxes/api/stocklists'; | ||
export const STOCKLIST_API = `${API}/stocklists`; | ||
export const STOCKLIST_EXPORT = id => `${STOCKLIST_API}/${id}/export`; | ||
export const STOCKLIST_DELETE = id => `${STOCKLIST_API}/${id}`; | ||
export const STOCKLIST_CLEAR = id => `${STOCKLIST_API}/${id}/clear`; | ||
export const STOCKLIST_CLONE = id => `${STOCKLIST_API}/${id}/clone`; | ||
export const STOCKLIST_PUBLISH = id => `${STOCKLIST_API}/${id}/publish`; | ||
export const STOCKLIST_UNPUBLISH = id => `${STOCKLIST_API}/${id}/unpublish`; | ||
|
||
// GL ACCOUNTS | ||
export const GL_ACCOUNTS_OPTION = `${API}/glAccountOptions`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import _ from 'lodash'; | ||
import queryString from 'query-string'; | ||
|
||
import glAccountApi from 'api/services/GlAccountApi'; | ||
import apiClient from 'utils/apiClient'; | ||
|
||
|
||
|
@@ -218,3 +219,8 @@ export const fetchProductsTags = async () => { | |
const response = await apiClient.get('/openboxes/api/tagOptions'); | ||
return response.data.data; | ||
}; | ||
|
||
export const fetchProductsGlAccounts = async () => { | ||
const { data } = await glAccountApi.getGlAccountOptions(); | ||
return data.data; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we could follow, since you've refactored some of our api calls to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm adding one additional comment, which should be rather answered by @awalkowiak - I'm wondering if we should wrap it inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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.
I am starting to dislike these parameters more with each new one. I think we could think about refactoring this one.