Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/amansinghbais/preorder into…
Browse files Browse the repository at this point in the history
… preorder/hotwax#166
  • Loading branch information
amansinghbais committed Sep 7, 2023
2 parents 7eea48b + 8a17c01 commit 5e8879d
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 173 deletions.
10 changes: 10 additions & 0 deletions src/apparel-sorter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ export function sortSizes(sizes: any) {
if (!sizes) {
return [];
}

const hasFloatNumSizes = sizes.some((size: string) => {
const sizeAsInt = +size
return (!Number.isNaN(sizeAsInt) && !Number.isInteger(sizeAsInt))
})

if (hasFloatNumSizes) {
return sizes.sort((a: string, b: string) => (+a) - (+b))
}

return sizes
.map(matchSizesWithRegexes)
.sort(sortSizesByIndex)
Expand Down
35 changes: 14 additions & 21 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<ion-menu-toggle auto-hide="false" v-for="(p, i) in appPages" :key="i">
<ion-item
button
@click="selectedIndex = i"
router-direction="root"
:router-link="p.url"
class="hydrated"
Expand Down Expand Up @@ -39,11 +38,12 @@ import {
IonMenu,
IonMenuToggle,
} from "@ionic/vue";
import { defineComponent, ref } from "vue";
import { computed, defineComponent} from "vue"
import { mapGetters } from "vuex";
import { albums ,shirt, pricetags, settings } from "ionicons/icons";
import { useStore } from "@/store";
import { useRouter } from "vue-router";
export default defineComponent({
name: "Menu",
Expand All @@ -59,30 +59,14 @@ export default defineComponent({
IonMenu,
IonMenuToggle,
},
created() {
// When open any specific page it should show that page selected
// TODO Find a better way
this.selectedIndex = this.appPages.findIndex((page) => {
return page.url === this.$router.currentRoute.value.path;
})
},
computed: {
...mapGetters({
isUserAuthenticated: 'user/isUserAuthenticated'
})
},
watch:{
$route (to) {
// When logout and login it should point to Oth index
// TODO Find a better way
if (to.path === '/login') {
this.selectedIndex = 0;
}
},
},
setup() {
const store = useStore();
const selectedIndex = ref(0);
const router = useRouter();
const appPages = [
{
title: "Orders",
Expand All @@ -93,12 +77,14 @@ export default defineComponent({
{
title: "Products",
url: "/products",
childRoutes: ["/product-details/"],
iosIcon: shirt,
mdIcon: shirt,
},
{
title: "Catalog",
url: "/catalog",
childRoutes: ["/catalog-product-details/"],
iosIcon: albums,
mdIcon: albums,
},
Expand All @@ -107,8 +93,15 @@ export default defineComponent({
url: "/settings",
iosIcon: settings,
mdIcon: settings,
},
}
];
const selectedIndex = computed(() => {
const path = router.currentRoute.value.path
return appPages.findIndex((screen) => screen.url === path || screen.childRoutes?.includes(path) || screen.childRoutes?.some((route)=> path.includes(route)))
})
return {
selectedIndex,
appPages,
Expand All @@ -118,7 +111,7 @@ export default defineComponent({
settings,
store
};
},
}
});
</script>
<style scoped>
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Active jobs": "Active jobs",
"Active purchase order": "Active purchase order",
"Added to pre-order category on, against PO but not listed on all stores" : "Added to pre-order category on {fromDate}, against PO #{POID} but not listed on all stores",
"Adding to in": "Adding to {categoryName} in {addingTime}",
"Adding to": "Adding to {categoryName} {addingTime}",
"All": "All",
"App": "App",
"Are you sure you want to update the promise date for these orders?": "Are you sure you want to update the promise date for these orders?",
Expand Down Expand Up @@ -145,6 +145,7 @@
"preorders will be cancelled. This action cannot be undone.": "{count} preorders will be cancelled. This action cannot be undone.",
"Products": "Products",
"Product details": "Product details",
"Product summary": "Product summary",
"Product cannot be pre-sold because it does not have active purchase orders": "Product cannot be pre-sold because it does not have active purchase orders",
"Product has been accepting from against PO #": "Product has been accepting {category}s from {fromDate} against PO #${POID}",
"Product is eligible for but not added to the category": "Product is eligible for {category}s but not added to the {category} category",
Expand All @@ -164,7 +165,8 @@
"Release preorder to a warehouse": "Release preorder to a warehouse",
"Release preorders to a warehouse": "Release preorders to a warehouse",
"Release to a warehouse": "Release to a warehouse",
"Removing from in": "Removing from {categoryName} in {removeTime}",
"Removing from": "Removing from {categoryName} {removeTime}",
"Removed from": "Removed from {categoryName} {removeTime}",
"Removed from category": "Removed from category",
"Removed from category on because there is no active PO but still listed on stores": "Removed from {category} category on {changeDatetime} because there is no active PO but still listed on {listedCount} stores",
"Reserve inventory": "Reserve inventory",
Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ const actions: ActionTree<ProductState, RootState> = {
return product
}

emitter.emit("presentLoader")

let resp;
let productFilterCondition: any = `docType: PRODUCT AND groupId: ${payload.productId}`;
if (!isProductCached) productFilterCondition = `docType: PRODUCT AND (productId: ${payload.productId} OR groupId: ${payload.productId})`
Expand Down Expand Up @@ -260,7 +258,6 @@ const actions: ActionTree<ProductState, RootState> = {
console.error(error)
showToast(translate("Something went wrong"));
}
emitter.emit("dismissLoader");
return product
},
/**
Expand Down
Loading

0 comments on commit 5e8879d

Please sign in to comment.