Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AntPos/dev-dist/sw.js

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

2 changes: 1 addition & 1 deletion AntPos/dev-dist/sw.js.map

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

4 changes: 3 additions & 1 deletion AntPos/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Sidebar from '@/components/Sidebar.vue';
const { brand } = getSettings()
const { currentComponent, loadComponent } = inject('dynamicComponent');
const posProfileStore = usePosProfileStore();
const sessionStore = useSessionStore();

usePageMeta(() => {
return {
Expand All @@ -40,7 +41,8 @@ usePageMeta(() => {
watch(
() => posProfileStore.hasNoData,
(val) => {
if (val && useSessionStore.isLoggedIn) {

if (val && sessionStore.isLoggedIn) {
loadComponent('OpenShift')
}
}
Expand Down
21 changes: 10 additions & 11 deletions AntPos/src/components/Customer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
</template>

<script setup>
import { computed, inject, onMounted, onUnmounted } from 'vue';
import { computed, inject, onMounted, onUnmounted, watch } from 'vue';
import emitter from '@/utils/emitter';
import Autocomplete from '@/components/custom_components/Autocomplete.vue';
import { createListResource,createResource } from 'frappe-ui';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';

let base = inject('base');
let errorHandled = false;

const getCustomerGroups = computed(()=>{
if (!usePosProfileStore().posProfileData?.customer_groups){

if (usePosProfileStore()?.hasNoData){
return []
}
return usePosProfileStore().posProfileData?.customer_groups.map(item=>item.customer_group);
Expand All @@ -33,14 +33,10 @@ const customerResource = createListResource({
filters: {
disabled: false,
},
orFilters: getCustomerGroups.value.length>0?[['customer_group', 'in', getCustomerGroups.value]]:[],
orFilters: getCustomerGroups?.value?.length > 0 ? [['customer_group', 'in', getCustomerGroups?.value]] : [],
pageLength: Number.MAX_VALUE * 2,
auto: true,
onSuccess(data) {
errorHandled = false;
},
auto: false,
onError(error) {
if (!errorHandled) {
createToast({
title: 'error',
message: Array.isArray(error?.messages) ? error.messages[0] : error?.messages || error || 'An error occurred',
Expand All @@ -49,8 +45,6 @@ const customerResource = createListResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
},
transform: (data) => {
return data.map((item) => ({
Expand Down Expand Up @@ -109,5 +103,10 @@ const selectedCustomer = computed({
},
});

watch(usePosProfileStore().hasNoData, (newVal) => {

customerResource.reload();

}, { immediate: true });

</script>
21 changes: 8 additions & 13 deletions AntPos/src/components/Dialog/CloseShift.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const store = usePosProfileStore();
const dialogVisible = ref(true);
const base = inject('base');
const data = ref(store.posProfileData.payments);
let errorHandled = false;

const totals = ref({
opening: 0,
Expand Down Expand Up @@ -171,23 +170,19 @@ const handleSubmit = createResource({
}
},
onSuccess(data) {
errorHandled = false;
emitter.emit('remove_invoice',true);
dialogVisible.value = false;
store.fetchPosProfile();
},
onError(error) {
if (!errorHandled) {
createToast({
title: 'error',
message: Array.isArray(error?.messages) ? error.messages[0] : error?.messages || 'An error occurred',
icon: 'x-circle',
iconClasses: 'bg-surface-red-5 text-ink-white rounded-md p-px',
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
createToast({
title: 'error',
message: Array.isArray(error?.messages) ? error.messages[0] : error?.messages || 'An error occurred',
icon: 'x-circle',
iconClasses: 'bg-surface-red-5 text-ink-white rounded-md p-px',
position: 'top-center',
timeout: 5,
});
},
});

Expand Down
4 changes: 0 additions & 4 deletions AntPos/src/components/Dialog/Held.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const selectedInvoice = ref(null);
const searchQuery = ref("");
const permissionStore = usePermissionStore();
const user = usersStore().getUser();
let errorHandled = false;
const selectedPageLength = ref(20);
const handleDialogClose = () => { dialogVisible.value = false; };

Expand Down Expand Up @@ -129,7 +128,6 @@ let salesInvoice = createResource({
return data
},
onSuccess: async (data) => {
errorHandled = false;
if (!data.docs[0]?.items || !Array.isArray(data.docs[0].items)) {
console.error("Invalid or missing items array", data.docs[0]?.items);
return;
Expand All @@ -145,7 +143,6 @@ let salesInvoice = createResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
});

Expand Down Expand Up @@ -193,7 +190,6 @@ let get_value = createResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
})

Expand Down
6 changes: 0 additions & 6 deletions AntPos/src/components/Dialog/Return.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { usePermissionStore } from '@/stores/permissionStore';
import { usersStore } from '@/stores/users';

let base = inject('base');
let errorHandled = false;
const store = usePosProfileStore();
const dialogVisible = ref(true);
const selectedInvoice = ref(null);
Expand Down Expand Up @@ -132,7 +131,6 @@ const runDoCMethod = createResource({
return data
},
onSuccess(data){
errorHandled = false;
addvalues();
},
onError(error) {
Expand All @@ -144,7 +142,6 @@ const runDoCMethod = createResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
});

Expand All @@ -160,7 +157,6 @@ let salesInvoice = createResource({
},
onSuccess: async (data) => {
await runDoCMethod.fetch({ for_validate: true, docs: data, method: 'set_missing_values', args: { "for_validate": true } });
errorHandled = false;
},
onError(error) {
createToast({
Expand All @@ -171,7 +167,6 @@ let salesInvoice = createResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}
});

Expand Down Expand Up @@ -256,7 +251,6 @@ const get_value = createResource({
position: 'top-center',
timeout: 5,
});
errorHandled = true;
}

})
Expand Down
Loading