Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 259-translate-from-dxp
  • Loading branch information
amansinghbais committed Jul 17, 2024
2 parents e6c7777 + 9964e0a commit 04177a2
Show file tree
Hide file tree
Showing 63 changed files with 2,653 additions and 679 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ VUE_APP_PERMISSION_ID=
VUE_APP_ALIAS={}
VUE_APP_DEFAULT_ALIAS=""
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login"
VUE_APP_CRON_EXPRESSIONS={"Every 5 minutes":"0 */5 * ? * *","Every 15 minutes":"0 */15 * ? * *","Every 30 minutes":"0 */30 * ? * *","Hourly":"0 0 * ? * *","Every six hours":"0 0 */6 ? * *","Every day at midnight":"0 0 0 * * ?"}
VUE_APP_LOGIN_URL="https://launchpad.hotwax.io/login"
10 changes: 5 additions & 5 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"projects": {
"default": "hotwax-digital-commerce",
"default": "hotwax-digital-commerce-uat",
"production": "digital-commerce-71eb8"
},
"targets": {
"hotwax-digital-commerce": {
"hotwax-digital-commerce-uat": {
"hosting": {
"dev": [
"dev-threshold-management"
"hotwax-atp-dev"
],
"uat": [
"threshold-management-uat"
"hotwax-atp-uat"
]
}
},
"digital-commerce-71eb8": {
"hosting": {
"prod": [
"threshold-management"
"hotwax-atp"
]
}
}
Expand Down
7 changes: 2 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Related Issues
<!-- Put related issue number which this PR is closing. For example #123 -->

Closes #
#

### Short Description and Why It's Useful
<!-- Describe in a few words what is this Pull Request changing and why it's useful -->
Expand All @@ -11,10 +11,7 @@
<!-- If you made any changes in the UI layer, please provide before/after screenshots -->


**IMPORTANT NOTICE** - Remember to add changelog entry


### Contribution and Currently Important Rules Acceptance
<!-- Please get familiar with following info -->

- [ ] I read and followed [contribution rules](https://github.com/hotwax/threshold-management#contribution-guideline)
- [ ] I read and followed [contribution rules](https://github.com/hotwax/available-to-promise#contribution-guideline)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Threshold Management App
Available to Promise App
# Prerequisite
Ionic CLI - If you don't have the ionic CLI installed refer [official documentation](https://ionicframework.com/docs/intro/cli) for the installation instructions.


# Build Notes (Users)

1. Download the app from [release](https://github.com/hotwax/threshold-management/releases) page and extract it.
1. Download the app from [release](https://github.com/hotwax/available-to-promise/releases) page and extract it.
2. Go to the app directory.
3. Run following command to download dependencies
`npm i`
Expand All @@ -16,7 +16,7 @@ Ionic CLI - If you don't have the ionic CLI installed refer [official documentat
# Build Notes (Contributors)

1. Open a Terminal window
2. Clone app using the command: `git clone https://github.com/hotwax/threshold-management.git <repository-name>`
2. Clone app using the command: `git clone https://github.com/hotwax/available-to-promise.git <repository-name>`
3. Go to the <repository-name> directory using command: `cd <repository-name>`
4. Run following command to download dependencies
`npm i`
Expand All @@ -27,11 +27,11 @@ Ionic CLI - If you don't have the ionic CLI installed refer [official documentat
# Contribution Guideline

1. Fork the repository and clone it locally from the `main` branch. Before starting your work make sure it's up to date with current `main` branch.
2. Pick an issue from [here](https://github.com/hotwax/threshold-management/issues). Write in the issue comment that you want to pick it, if you can't assign yourself. **Please stay assigned to one issue at a time to not block others**.
3. Create a branch for your edits. Use the following branch naming conventions: **threshold-management/issue-number**.
2. Pick an issue from [here](https://github.com/hotwax/available-to-promise/issues). Write in the issue comment that you want to pick it, if you can't assign yourself. **Please stay assigned to one issue at a time to not block others**.
3. Create a branch for your edits. Use the following branch naming conventions: **available-to-promise/issue-number**.
4. Please add issue number to your commit message.
5. Propose a Pull Request to `main` branch containing issue number and issue title.
6. Use [Pull Request template](https://github.com/hotwax/threshold-management/blob/main/.github/PULL_REQUEST_TEMPLATE.md) (it's automatically added to each PR) and fill as much fields as possible to describe your solution.
6. Use [Pull Request template](https://github.com/hotwax/available-to-promise/blob/main/.github/PULL_REQUEST_TEMPLATE.md) (it's automatically added to each PR) and fill as much fields as possible to describe your solution.
7. Reference any relevant issues or other information in your PR.
8. Wait for review and adjust your PR according to it.
9. Congrats! Your PR should now be merged in!
Expand All @@ -55,4 +55,4 @@ If you have any questions or ideas feel free to join our <a href="https://discor

# The license

Threshold Management app is completely free and released under the Apache v2.0 License. Check <a href="https://github.com/hotwax/threshold-management/blob/main/LICENSE" target="_blank">LICENSE</a> for more details.
Available to Promise app is completely free and released under the Apache v2.0 License. Check <a href="https://github.com/hotwax/available-to-promise/blob/main/LICENSE" target="_blank">LICENSE</a> for more details.
4 changes: 2 additions & 2 deletions capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"appId": "co.hotwax.thresholdmanagement",
"appName": "Threshold Management",
"appId": "co.hotwax.availabletopromise",
"appName": "Available to Promise",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "dist",
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HotWax Commerce Threshold Management",
"short_name": "Threshold Management",
"name": "HotWax Commerce Available to Promise",
"short_name": "Available to Promise",
"theme_color": "#FFFFFF",
"icons": [{
"src": "public/img/icons/favicon-16x16.png",
Expand Down
23 changes: 5 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "threshold-management",
"version": "2.8.0",
"name": "available-to-promise",
"version": "3.0.2",
"private": true,
"description": "Threshold Management",
"description": "Available to Promise",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
Expand All @@ -19,6 +19,7 @@
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.2.6",
"@hotwax/dxp-components": "^1.13.0",
"@hotwax/oms-api": "^1.14.0",
"@ionic/core": "7.6.0",
"@ionic/vue": "7.6.0",
"@ionic/vue-router": "7.6.0",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Threshold Management - HotWax Commerce</title>
<title>Available to Promise - HotWax Commerce</title>

<base href="/" />

Expand Down
35 changes: 26 additions & 9 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,35 @@

<script setup lang="ts">
import { IonApp, IonRouterOutlet, IonSplitPane, loadingController } from '@ionic/vue';
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { computed, onBeforeMount, onMounted, onUnmounted, ref } from 'vue';
import emitter from "@/event-bus"
import { Settings } from 'luxon'
import Menu from '@/components/Menu.vue';
import store from "./store";
import { translate } from '@hotwax/dxp-components';
import { initialise, resetConfig } from '@/adapter'
const loader = ref(null) as any
const userProfile = computed(() => store.getters["user/getUserProfile"])
const userToken = computed(() => store.getters["user/getUserToken"])
const instanceUrl = computed(() => store.getters["user/getInstanceUrl"])
const loader = ref(null) as any
const maxAge = process.env.VUE_APP_CACHE_MAX_AGE ? parseInt(process.env.VUE_APP_CACHE_MAX_AGE) : 0
initialise({
token: userToken.value,
instanceUrl: instanceUrl.value,
cacheMaxAge: maxAge,
events: {
responseError: () => {
setTimeout(() => dismissLoader(), 100);
},
queueTask: (payload: any) => {
emitter.emit("queueTask", payload);
}
}
})
async function presentLoader(options = { message: '', backdropDismiss: true }) {
// When having a custom message remove already existing loader
Expand All @@ -42,16 +61,12 @@ function dismissLoader() {
}
}
onMounted(async () => {
loader.value = await loadingController
.create({
message: translate("Click the backdrop to dismiss."),
translucent: true,
backdropDismiss: true
});
onBeforeMount(() => {
emitter.on('presentLoader', presentLoader);
emitter.on('dismissLoader', dismissLoader);
})
onMounted(async () => {
// Handles case when user resumes or reloads the app
// Luxon timezzone should be set with the user's selected timezone
if (userProfile.value && userProfile.value.timeZone) {
Expand All @@ -62,6 +77,8 @@ onMounted(async () => {
onUnmounted(() => {
emitter.off("presentLoader", presentLoader);
emitter.off("dismissLoader", dismissLoader);
resetConfig()
})
</script>
<style>
Expand Down
15 changes: 15 additions & 0 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { api, client, getConfig, getProductIdentificationPref, getUserFacilities, initialise, logout, resetConfig, setProductIdentificationPref, updateInstanceUrl, updateToken } from '@hotwax/oms-api'

export {
api,
client,
getConfig,
getProductIdentificationPref,
getUserFacilities,
initialise,
logout,
resetConfig,
setProductIdentificationPref,
updateInstanceUrl,
updateToken
}
7 changes: 4 additions & 3 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import OfflineHelper from "@/offline-helper"
import emitter from "@/event-bus"
import store from "@/store";
import { StatusCodes } from "http-status-codes";
import router from "@/router"

axios.interceptors.request.use((config: any) => {
// TODO: pass csrf token
Expand Down Expand Up @@ -46,7 +45,9 @@ axios.interceptors.response.use(function (response: any) {
const { status } = error.response;
if (status === StatusCodes.UNAUTHORIZED) {
store.dispatch("user/logout");
router.push("/login")
const redirectUrl = window.location.origin + '/login';
// Explicitly passing isLoggedOut as in case of maarg apps we need to call the logout api in launchpad
window.location.href = `${process.env.VUE_APP_LOGIN_URL}?redirectUrl=${redirectUrl}&isLoggedOut=true`;
}
}
// Any status codes that falls outside the range of 2xx cause this function to trigger
Expand Down Expand Up @@ -86,7 +87,7 @@ const api = async (customConfig: any) => {
}

const baseURL = store.getters["user/getInstanceUrl"];
if (baseURL) config.baseURL = `https://${baseURL}.hotwax.io/rest/s1/available-to-promise/`;
if (baseURL) config.baseURL = baseURL.startsWith('http') ? baseURL.includes('/rest/s1/available-to-promise') ? baseURL : `${baseURL}/rest/s1/available-to-promise/` : `https://${baseURL}.hotwax.io/rest/s1/available-to-promise/`;
if(customConfig.cache) config.adapter = axiosCache.adapter;
const networkStatus = await OfflineHelper.getNetworkStatus();
if (customConfig.queue && !networkStatus.connected) {
Expand Down
8 changes: 6 additions & 2 deletions src/components/AddProductFacilityGroupModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
</ion-button>
</ion-buttons>
<ion-title>{{ type === "included" ? translate("Include facility groups") : translate("Exclude facility groups") }}</ion-title>
<ion-buttons slot="end">
<!-- Clear button should be disabled till no group is selected -->
<ion-button fill="clear" color="danger" :disabled="!selectedGroups.length" @click="selectedGroups = []">{{ translate("Clear All") }}</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-list v-if="facilityGroups.length">
<ion-item v-for="group in facilityGroups" :key="group.facilityGroupId" @click="updateSelectedGroups(group)">
<ion-item v-for="group in facilityGroups" :key="group.facilityGroupId" @click="!isAlreadyApplied(group.facilityGroupId) ? updateSelectedGroups(group) : null">
<ion-label v-if="isAlreadyApplied(group.facilityGroupId)">{{ group.facilityGroupName }}</ion-label>
<ion-checkbox v-if="!isAlreadyApplied(group.facilityGroupId)" :checked="isAlreadySelected(group.facilityGroupId)">
{{ group.facilityGroupName }}
{{ group.facilityGroupName ? group.facilityGroupName : group.facilityGroupId }}
</ion-checkbox>
<ion-note v-else slot="end" color="danger">{{ type === 'included' ? translate("excluded") : translate("included") }}</ion-note>
</ion-item>
Expand Down
15 changes: 11 additions & 4 deletions src/components/AddProductFiltersModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,30 @@
</ion-buttons>
<ion-title>{{ type === "included" ? translate("Include", { label }) : translate("Exclude", { label }) }}</ion-title>
<ion-buttons slot="end">
<ion-button fill="clear" color="danger" @click="selectedValues = []">{{ translate("Clear All") }}</ion-button>
<!-- Clear all button should be disabled if no facetOptions are available to select or if no filter is selected. -->
<ion-button fill="clear" color="danger" :disabled="!facetOptions.length || !selectedValues.length" @click="selectedValues = []">{{ translate("Clear All") }}</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-searchbar :placeholder="translate('Search', { label })" v-model="queryString" @keyup.enter="search()"/>

<ion-list>
<ion-item v-for="option in facetOptions" :key="option.id" @click="updateSelectedValues(option.id)">
<ion-list v-if="facetOptions.length">
<ion-item v-for="option in facetOptions" :key="option.id" @click="!isAlreadyApplied(option.id) ? updateSelectedValues(option.id) : null">
<ion-label v-if="isAlreadyApplied(option.id)">{{ option.label }}</ion-label>
<ion-checkbox v-if="!isAlreadyApplied(option.id)" :checked="selectedValues.includes(option.id)">
{{ option.label }}
</ion-checkbox>
<ion-note v-else slot="end" color="danger">{{ type === 'included' ? translate("excluded") : translate("included") }}</ion-note>
</ion-item>
</ion-list>
<div class="empty-state" v-else-if="!queryString">
<p>{{ translate("Search for to find results", { label }) }}</p>
</div>
<div class="empty-state" v-else>
<p>{{ translate("No result found for", { label: queryString }) }}</p>
</div>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="saveFilters()">
Expand Down Expand Up @@ -91,7 +98,7 @@ function search() {
async function getFilters(vSize?: any, vIndex?: any) {
const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE;
const viewIndex = vIndex ? vIndex : 0;
const payload = {
facetToSelect: props.facetToSelect,
docType: 'PRODUCT',
Expand Down
Loading

0 comments on commit 04177a2

Please sign in to comment.