-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from hotwax/57_virtual_facilities
Implemented: Added Parking page UI.
- Loading branch information
Showing
11 changed files
with
323 additions
and
2 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
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
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,59 @@ | ||
const prepareOrderQuery = (params: any) => { | ||
const viewSize = params.viewSize ? params.viewSize : process.env.VUE_APP_VIEW_SIZE; | ||
const viewIndex = params.viewIndex ? params.viewIndex : 0; | ||
|
||
const payload = { | ||
"json": { | ||
"params": { | ||
"rows": viewSize, | ||
"sort": params.sort ? params.sort : "reservedDatetime asc", | ||
"group": true, | ||
"group.field": params.groupBy ? params.groupBy : "orderId", | ||
"group.limit": 1000, | ||
"group.ngroups": true, | ||
"q.op": "AND", | ||
"start": viewIndex * viewSize | ||
}, | ||
"query":"(*:*)", | ||
"filter": [`docType: ${params.docType ? params.docType : 'OISGIR'}`] | ||
} | ||
} as any | ||
|
||
if (params.queryString) { | ||
payload.json.query = `(*${params.queryString}*) OR "${params.queryString}"^100` | ||
payload.json.params['qf'] = params.queryFields ? params.queryFields : "productId productName virtualProductName orderId productSku customerId customerName search_orderIdentifications goodIdentifications" | ||
payload.json.params['defType'] = "edismax" | ||
} | ||
|
||
// checking that if the params has filters, and then adding the filter values in the payload filter | ||
// for each key present in the params filters | ||
if (params.filters) { | ||
Object.keys(params.filters).map((key: any) => { | ||
const filterValue = params.filters[key].value; | ||
|
||
if (Array.isArray(filterValue)) { | ||
const filterOperator = params.filters[key].op ? params.filters[key].op : 'OR' ; | ||
payload.json.filter += ` AND ${key}: (${filterValue.join(' ' + filterOperator + ' ')})` | ||
} else { | ||
payload.json.filter += ` AND ${key}: ${filterValue}` | ||
} | ||
}) | ||
} | ||
|
||
if(params.facet) { | ||
payload.json['facet'] = params.facet | ||
} | ||
|
||
return payload | ||
} | ||
|
||
const escapeSolrSpecialChars = (input: any) => { | ||
const specialChars = ['\\', '+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':']; | ||
|
||
// Escape each special character in the input | ||
const escapedInput = String(input).replace(new RegExp(`[${specialChars.join('\\')}]`, 'g'), '\\$&'); | ||
return escapedInput; | ||
} | ||
|
||
export { escapeSolrSpecialChars, prepareOrderQuery } | ||
|
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
Oops, something went wrong.