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/src/components/Customer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>

<script setup>
import { computed, inject, onMounted, onUnmounted, watch, defineProps } from 'vue';
import { computed, onMounted, onUnmounted, watch, defineProps } from 'vue';
import emitter from '@/utils/emitter';
import Autocomplete from '@/components/custom_components/Autocomplete.vue';
import { createListResource } from 'frappe-ui';
Expand Down
2 changes: 1 addition & 1 deletion AntPos/src/components/Dialog/CloseShift.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@


<script setup>
import { ref, inject, defineEmits, watch } from 'vue';
import { ref, watch } from 'vue';
import { Button, Dialog, FormControl, createResource, debounce,Spinner} from 'frappe-ui';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';
Expand Down
2 changes: 1 addition & 1 deletion AntPos/src/components/Dialog/CustomerForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</template>

<script setup>
import { ref, computed, inject } from 'vue';
import { ref, computed } from 'vue';
import { Dialog, createListResource, Button, FormControl, createResource } from 'frappe-ui';
import emitter from '@/utils/emitter';
import { showToast } from '@/utils';
Expand Down
2 changes: 1 addition & 1 deletion AntPos/src/components/Dialog/Held.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

<script setup>
import { Dialog, Button, createListResource, createResource, TextInput, FeatherIcon } from 'frappe-ui';
import { ref, inject, computed, watch } from 'vue';
import { ref, computed, watch } from 'vue';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';
import { usePermissionStore } from '@/stores/permission';
Expand Down
2 changes: 1 addition & 1 deletion AntPos/src/components/Dialog/Return.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

<script setup>
import { Dialog, Button, createListResource, createResource, TextInput, debounce, FeatherIcon } from 'frappe-ui';
import { ref, inject, computed, watch } from 'vue';
import { ref, computed, watch } from 'vue';
import { createToast } from '@/utils';
import { usePosProfileStore } from '@/stores/posProfile';
import { usePermissionStore } from '@/stores/permission';
Expand Down
10 changes: 2 additions & 8 deletions AntPos/src/components/Dialog/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@
<script setup>
import { Dialog, Button, FeatherIcon ,FormControl, Badge, ErrorMessage } from 'frappe-ui';
import ImageUploader from '@/components/Controls/ImageUploader.vue'
import { ref, onBeforeMount } from 'vue';
import {ref} from 'vue';
import { getSettings } from '@/stores/settings'

const dialogVisible = ref(true);
const { setting, settings, setupBrand } = getSettings()
const { setting: settings, setupBrand } = getSettings()

function updateSettings() {
settings.save.submit(null, {
Expand All @@ -137,11 +137,5 @@ function updateSettings() {
},
})
}
onBeforeMount(()=>{
settings.get
// setupBrand()


})

</script>
23 changes: 16 additions & 7 deletions AntPos/src/components/Invoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@

<script setup>
import { Button, FormControl, createResource, DatePicker, dayjsLocal } from 'frappe-ui'
import { ref, inject, onMounted , watch, computed } from 'vue'
import { ref, onMounted , watch, computed } from 'vue'
import { createToast } from '@/utils';
import { showToast } from '@/utils'
import emitter from '@/utils/emitter';
Expand All @@ -244,6 +244,7 @@ const invoiceStore = useInvoiceStore()
const baseurl = createResource({url: 'ant_pos.ant_pos.utils.get_domain_url',});
const addPayments = () => {
invoiceStore.invoice.paid_amount = invoiceStore.invoice.base_rounded_total
if (!invoiceStore.invoice.payments) invoiceStore.invoice.payments = []
store.posProfileData.payments.forEach(element => {
if (!invoiceStore.invoice.payments.some(payment => payment.mode_of_payment === element.mode_of_payment) && (invoiceStore.invoice.is_return && element.allow_in_returns || !invoiceStore.invoice.is_return )) {
invoiceStore.invoice.payments.push({
Expand Down Expand Up @@ -279,10 +280,6 @@ const deliveryDate = computed({
}
})

onMounted(() => {
addPayments()
})

const createSaveResource = createResource({
url: 'frappe.desk.form.save.savedocs',
makeParams(params) {
Expand Down Expand Up @@ -389,7 +386,7 @@ const createPrint = async (name) =>{
}
}

let advance = createResource({
createResource({
url: 'run_doc_method',
auto: true,
makeParams(params) {
Expand All @@ -399,7 +396,16 @@ let advance = createResource({
}
},
onSuccess(data) {
invoiceStore.invoice = {...data.docs[0],is_pos: true}
for (const key in data.docs[0]) {

const existingValue = invoiceStore.invoice[key];
const newValue = data.docs[0][key];

// Check for changes or new keys
if (key !== 'is_pos' && key !== 'docstatus' && JSON.stringify(existingValue) !== JSON.stringify(newValue)) {
invoiceStore.invoice[key] = newValue;
}
}
addPayments()
},
onError(error) {
Expand Down Expand Up @@ -491,4 +497,7 @@ watch(
{ deep: true }
);

onMounted(() => {
addPayments()
})
</script>
2 changes: 1 addition & 1 deletion AntPos/src/components/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
</template>
<script setup>
import { FeatherIcon, FormControl, Autocomplete, DatePicker, dayjsLocal, createResource, createListResource,debounce } from 'frappe-ui';
import { inject, watch, defineProps, onMounted, onUnmounted, computed } from 'vue';
import { watch, defineProps, onMounted, onUnmounted, computed } from 'vue';
import { showToast } from '@/utils'
import emitter from '@/utils/emitter';
import { usePosProfileStore } from '@/stores/posProfile';
Expand Down
6 changes: 1 addition & 5 deletions AntPos/src/components/ItemSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<script setup>
import { FormControl, FeatherIcon, createResource } from 'frappe-ui';
import { ref, inject, onMounted, onUnmounted } from 'vue';
import { ref, onMounted } from 'vue';
import { createToast } from '@/utils';
import { showToast } from '@/utils'
import { usePosProfileStore } from '@/stores/posProfile';
Expand Down Expand Up @@ -315,8 +315,4 @@ onMounted(() => {
});
})

onUnmounted(()=>{
invoiceStore.unmount()
})

</script>
9 changes: 8 additions & 1 deletion AntPos/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</template>

<script setup>
import { FeatherIcon, Dropdown, createResource, Button } from 'frappe-ui';
import { FeatherIcon, Dropdown, Button } from 'frappe-ui';
import { useRouter } from 'vue-router';
import { inject, h, computed } from 'vue';
import { getSettings } from '@/stores/settings'
Expand Down Expand Up @@ -136,6 +136,13 @@ const option=[
loadComponent('CloseShift')
},
},
{
label: 'Desk',
icon: () => h(FeatherIcon, { name: 'home' }),
onClick: () => {
window.location.href = '/app'
},
},
{
label: 'Settings',
icon: () => h(FeatherIcon, { name: 'settings' }),
Expand Down
7 changes: 5 additions & 2 deletions AntPos/src/pages/Pos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</template>

<script setup>
import { computed, inject, onBeforeMount } from 'vue';
import { computed, onBeforeMount,onUnmounted } from 'vue';
import ItemSelector from '@/components/ItemSelector.vue';
import Invoice from '@/components/Invoice.vue';
import ItemDetail from '@/components/ItemDetail.vue';
Expand All @@ -26,9 +26,12 @@ const currentComponent = computed(() =>


onBeforeMount(() => {

invoiceStore.invoiceResource.fetch()

});
onUnmounted(()=>{
invoiceStore.unmount()
})

</script>

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

Loading