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.

27 changes: 12 additions & 15 deletions AntPos/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,30 @@

<script setup>
import { FrappeUIProvider } from 'frappe-ui'
import { onBeforeMount, provide, watch, } from 'vue';
import { inject, watch } from 'vue';
import { usePosProfileStore } from '@/stores/posProfile';
import { useDynamicComponent } from '@/utils/Dialog';
import { usePageMeta } from 'frappe-ui';
import { usePageMeta } from 'frappe-ui';
import { getSettings } from '@/stores/settings';
import { useSessionStore } from '@/stores/session';
import Navbar from '@/components/Navbar.vue';
import Sidebar from '@/components/Sidebar.vue';

const { brand } = getSettings()
const { currentComponent, loadComponent } = useDynamicComponent();

provide('dynamicComponent', { currentComponent, loadComponent });
const { currentComponent, loadComponent } = inject('dynamicComponent');
const posProfileStore = usePosProfileStore();

usePageMeta(() => {
return {
icon: brand.favicon ? brand.favicon : '/assets/ant_pos/antPOS.png',
}
})

onBeforeMount(() => {
usePosProfileStore().fetchPosProfile();
});

watch(() => usePosProfileStore().hasNoData, (val) => {
if (val) {
loadComponent('OpenShift')
watch(
() => posProfileStore.hasNoData,
(val) => {
if (val && useSessionStore.isLoggedIn) {
loadComponent('OpenShift')
}
}
})

)
</script>
12 changes: 11 additions & 1 deletion AntPos/src/components/Customer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,28 @@
import { computed, inject, onMounted, onUnmounted } from 'vue';
import emitter from '@/utils/emitter';
import Autocomplete from '@/components/custom_components/Autocomplete.vue';
import { createListResource } from 'frappe-ui';
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){
return []
}
return usePosProfileStore().posProfileData?.customer_groups.map(item=>item.customer_group);

})

const customerResource = createListResource({
doctype: 'Customer',
fields: ['name', 'mobile_no','customer_group','territory','is_internal_customer'],
filters: {
disabled: false,
},
orFilters: getCustomerGroups.value.length>0?[['customer_group', 'in', getCustomerGroups.value]]:[],
pageLength: Number.MAX_VALUE * 2,
auto: true,
onSuccess(data) {
Expand Down
7 changes: 6 additions & 1 deletion AntPos/src/components/Dialog/Held.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ import { Dialog, Button, createListResource, createResource, TextInput, FeatherI
import { ref, inject, computed, watch } from 'vue';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';
import { usePermissionStore } from '@/stores/permissionStore';
import { usersStore } from '@/stores/users';

const store = usePosProfileStore();
let base = inject('base');
const dialogVisible = ref(true);
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 @@ -199,7 +203,8 @@ const invoices = createListResource({
orderBy: 'creation desc',
filters: {
docstatus: 0,
pos_profile: store.posProfileData.name,
pos_profile: store.posProfileData.name,
owner: permissionStore.salesInvoiceCanOnlyOwn ? user.name : undefined,
},
orFilters: [],
pageLength: 20,
Expand Down
10 changes: 8 additions & 2 deletions AntPos/src/components/Dialog/Return.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@

<script setup>
import { Dialog, Button, createListResource, createResource, TextInput, debounce, FeatherIcon } from 'frappe-ui';
import { ref, inject, computed, watch, onMounted } from 'vue';
import { ref, inject, computed, watch } from 'vue';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';
import { usePermissionStore } from '@/stores/permissionStore';
import { usersStore } from '@/stores/users';

let base = inject('base');
let errorHandled = false;
Expand All @@ -80,6 +82,8 @@ const selectedInvoice = ref(null);
const searchQuery = ref("");
const selectedPageLength = ref(20);
const handleDialogClose = () => { dialogVisible.value = false; };
const permissionStore = usePermissionStore();
const user = usersStore().getUser();

const setPageLength = (size) => {
if (selectedPageLength.value !== size) {
Expand Down Expand Up @@ -179,7 +183,9 @@ const invoices = createListResource({
docstatus: 1,
pos_profile: store.posProfileData.name,
is_return: 0,
status: ['!=', 'Credit Note Issued']
status: ['!=', 'Credit Note Issued'],
owner: permissionStore.salesInvoiceCanOnlyOwn ? user.name : undefined,

},
orFilters: [],
pageLength: 20,
Expand Down
7 changes: 6 additions & 1 deletion AntPos/src/components/ItemDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
RETURN
</Button>
<Button
v-if="permissionStore.salesInvoiceCanCreate"
:ref_for="true"
label="Button"
:loading="false"
Expand All @@ -152,6 +153,7 @@
SAVE/NEW
</Button>
<Button
v-if="permissionStore.salesInvoiceCanSubmit"
:ref_for="true"
label="Button"
:loading="false"
Expand All @@ -164,6 +166,7 @@
PAY
</Button>
<Button
v-if="permissionStore.salesInvoiceCanPrint && permissionStore.salesInvoiceCanCreate"
:ref_for="true"
label="Button"
:loading="false"
Expand All @@ -186,11 +189,13 @@ import Customer from '@/components/Customer.vue';
import { Button, FeatherIcon , FormControl , createResource,} from 'frappe-ui';
import { inject , watch } from 'vue';
import { createToast } from '@/utils';
import emitter from '@/utils/emitter';
import { usePosProfileStore } from '@/stores/posProfile';
import { usePermissionStore } from '@/stores/permissionStore';
import emitter from '@/utils/emitter';
import Item from '@/components/Item.vue';

const store = usePosProfileStore();
const permissionStore = usePermissionStore();
const { loadComponent } = inject('dynamicComponent');
const baseurl = createResource({url: 'ant_pos.ant_pos.utils.get_domain_url'});
let base = inject('base');
Expand Down
Loading