-
Notifications
You must be signed in to change notification settings - Fork 36
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
Improved: Returns page & returns-detail page(#2v7gpv1) #132
Changes from all commits
83625d4
d9c327c
2da45c9
cf312b3
e614215
9c9b83a
8b6401c
7d9609b
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 |
---|---|---|
|
@@ -10,7 +10,15 @@ | |
<ion-content> | ||
<main> | ||
<ion-item lines="none"> | ||
<h1>{{ $t("Shipment ID") }}: {{ current.shipmentId }}</h1> | ||
<ion-list class="ion-text-center"> | ||
<ion-title>{{ current.shopifyOrderName ? current.shopifyOrderName : current.hcOrderId }}</ion-title> | ||
<!-- TODO: Fetch Customer name --> | ||
<!-- <ion-label>{{ $t("Customer: <customer name>")}}</ion-label> --> | ||
</ion-list> | ||
<ion-item slot="end" lines="none"> | ||
<ion-badge :color="statusColorMapping[current.statusDesc]" slot="end">{{ current.statusDesc }}</ion-badge> | ||
<ion-chip v-if="current.trackingCode" slot="end">{{ current.trackingCode }}</ion-chip> | ||
</ion-item> | ||
</ion-item> | ||
|
||
<div class="shipment-scanner"> | ||
|
@@ -35,24 +43,33 @@ | |
<p>{{ getProduct(item.productId).productId }}</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item class="product-count"> | ||
<ion-item :disabled="true" lines="none"> | ||
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. do we need an item here? why can't we just put a chip here 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. We can do that sir. Fixed it. |
||
<ion-chip outline="true"> | ||
<ion-icon :icon="locationOutline" /> | ||
<ion-label>{{ current.locationSeqId }}</ion-label> | ||
</ion-chip> | ||
</ion-item> | ||
<ion-item v-if="isReturnReceivable(current.statusId)" class="product-count"> | ||
<ion-label position="floating">{{ $t("Qty") }}</ion-label> | ||
<ion-input type="number" min="0" v-model="item.quantityAccepted" /> | ||
</ion-item> | ||
<ion-item v-if="!isReturnReceivable(current.statusId)" class="product-count" lines="none"> | ||
<ion-label>{{ item.quantityAccepted }} {{ $t("received") }}</ion-label> | ||
</ion-item> | ||
</div> | ||
|
||
<ion-item class="border-top" v-if="item.quantityOrdered > 0"> | ||
<ion-button @click="receiveAll(item)" slot="start" fill="outline"> | ||
<ion-button v-if="isReturnReceivable(current.statusId)" @click="receiveAll(item)" slot="start" fill="outline"> | ||
{{ $t("Receive All") }} | ||
</ion-button> | ||
<ion-progress-bar :value="item.quantityAccepted/item.quantityOrdered" /> | ||
<p slot="end">{{ item.quantityOrdered }}</p> | ||
<p slot="end">{{ item.quantityOrdered }} {{ $t("returned") }}</p> | ||
</ion-item> | ||
</ion-card> | ||
</main> | ||
|
||
<ion-fab vertical="bottom" horizontal="end" slot="fixed"> | ||
<ion-fab-button v-if="validStatusChange(current.statusId)" @click="completeShipment"> | ||
<ion-fab-button v-if="isReturnReceivable(current.statusId)" @click="completeShipment"> | ||
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 think we should put this on the parent container. we wouldn't want an empty element floating around the ui 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. Sure sir. Placed it inside a div. 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. |
||
<ion-icon :icon="checkmarkDone" /> | ||
</ion-fab-button> | ||
</ion-fab> | ||
|
@@ -63,8 +80,10 @@ | |
<script lang="ts"> | ||
import { | ||
IonBackButton, | ||
IonBadge, | ||
IonButton, | ||
IonCard, | ||
IonChip, | ||
IonContent, | ||
IonHeader, | ||
IonFab, | ||
|
@@ -73,6 +92,7 @@ import { | |
IonItem, | ||
IonInput, | ||
IonLabel, | ||
IonList, | ||
IonPage, | ||
IonProgressBar, | ||
IonThumbnail, | ||
|
@@ -82,20 +102,24 @@ import { | |
alertController, | ||
} from '@ionic/vue'; | ||
import { defineComponent } from 'vue'; | ||
import { checkmarkDone, barcodeOutline } from 'ionicons/icons'; | ||
import { checkmarkDone, barcodeOutline, locationOutline } from 'ionicons/icons'; | ||
import { mapGetters, useStore } from "vuex"; | ||
import AddProductModal from '@/views/AddProductModal.vue' | ||
import Image from "@/components/Image.vue"; | ||
import { useRouter } from 'vue-router'; | ||
import Scanner from "@/components/Scanner.vue"; | ||
import ImageModal from '@/components/ImageModal.vue'; | ||
import { showToast } from '@/utils' | ||
import { translate } from '@/i18n' | ||
|
||
export default defineComponent({ | ||
name: "ReturnDetails", | ||
components: { | ||
IonBackButton, | ||
IonBadge, | ||
IonButton, | ||
IonCard, | ||
IonChip, | ||
IonContent, | ||
IonHeader, | ||
IonFab, | ||
|
@@ -104,6 +128,7 @@ export default defineComponent({ | |
IonItem, | ||
IonInput, | ||
IonLabel, | ||
IonList, | ||
IonPage, | ||
IonProgressBar, | ||
IonThumbnail, | ||
|
@@ -114,17 +139,28 @@ export default defineComponent({ | |
props: ["shipment"], | ||
data() { | ||
return { | ||
queryString: '' | ||
queryString: '', | ||
statusColorMapping: { | ||
'Received': 'success', | ||
'Approved': 'tertiary', | ||
'Cancelled': 'danger', | ||
'Shipped': 'medium', | ||
'Created': 'medium' | ||
} as any | ||
} | ||
}, | ||
mounted() { | ||
this.store.dispatch('return/setCurrent', { shipmentId: this.$route.params.id }) | ||
async mounted() { | ||
const current = await this.store.dispatch('return/setCurrent', { shipmentId: this.$route.params.id }) | ||
if(!this.isReturnReceivable(current.statusId)) { | ||
showToast(translate("This return has been and cannot be edited.", { status: current?.statusDesc?.toLowerCase() })); | ||
} | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
current: 'return/getCurrent', | ||
getProduct: 'product/getProduct', | ||
validStatusChange: 'return/isReturnReceivable' | ||
isReturnReceivable: 'return/isReturnReceivable', | ||
returns: 'return/getReturns' | ||
}), | ||
}, | ||
methods: { | ||
|
@@ -187,8 +223,10 @@ export default defineComponent({ | |
} | ||
}) | ||
}, | ||
updateProductCount(payload: any){ | ||
updateProductCount(payload?: any){ | ||
if(this.queryString) payload = this.queryString | ||
// if not a valid status, skip updating the qunatity | ||
if(!this.isReturnReceivable(this.current.statusId)) return; | ||
this.store.dispatch('return/updateReturnProductCount', payload) | ||
}, | ||
async scanCode () { | ||
|
@@ -210,6 +248,7 @@ export default defineComponent({ | |
return { | ||
barcodeOutline, | ||
checkmarkDone, | ||
locationOutline, | ||
store, | ||
router | ||
}; | ||
|
@@ -233,9 +272,10 @@ ion-thumbnail { | |
border-top: 1px solid #ccc; | ||
} | ||
|
||
|
||
.product-info { | ||
display: grid; | ||
grid-template-columns: 1fr .25fr; | ||
grid-template-columns: 1fr 1fr .30fr; | ||
align-items: center; | ||
padding: 16px; | ||
padding-left: 0; | ||
|
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.
shouldn't use ion-item here. Instead we can use an ion-row here or normal div with css
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.
Done sir