mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
rename variable name
This commit is contained in:
@ -361,7 +361,7 @@ function hasActiveUrl(id) {
|
|||||||
return route.params.id == id
|
return route.params.id == id
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadEstimates(params, isScroll = false) {
|
async function loadEstimates(params, fromScrollListener = false) {
|
||||||
if (isLoading.value) {
|
if (isLoading.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -376,21 +376,21 @@ async function loadEstimates(params, isScroll = false) {
|
|||||||
|
|
||||||
currentPageNumber.value = params ? params.page : 1
|
currentPageNumber.value = params ? params.page : 1
|
||||||
lastPageNumber.value = response.data.meta.last_page
|
lastPageNumber.value = response.data.meta.last_page
|
||||||
let isEstimateExist = estimateList.value.find(
|
let estimateFound = estimateList.value.find(
|
||||||
(est) => est.id == route.params.id
|
(est) => est.id == route.params.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isScroll == false &&
|
fromScrollListener == false &&
|
||||||
!isEstimateExist &&
|
!estimateFound &&
|
||||||
currentPageNumber.value < lastPageNumber.value
|
currentPageNumber.value < lastPageNumber.value
|
||||||
) {
|
) {
|
||||||
loadEstimates({ page: ++currentPageNumber.value })
|
loadEstimates({ page: ++currentPageNumber.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEstimateExist) {
|
if (estimateFound) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isScroll == false) {
|
if (fromScrollListener == false) {
|
||||||
scrollToEstimate()
|
scrollToEstimate()
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -402,11 +402,11 @@ function scrollToEstimate() {
|
|||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: 'smooth' })
|
el.scrollIntoView({ behavior: 'smooth' })
|
||||||
el.classList.add('shake')
|
el.classList.add('shake')
|
||||||
addScrollListner()
|
addScrollListener()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addScrollListner() {
|
function addScrollListener() {
|
||||||
estimateListSection.value.addEventListener('scroll', (ev) => {
|
estimateListSection.value.addEventListener('scroll', (ev) => {
|
||||||
if (
|
if (
|
||||||
ev.target.scrollTop > 0 &&
|
ev.target.scrollTop > 0 &&
|
||||||
|
|||||||
@ -416,8 +416,8 @@ function onCurrencyChange(v) {
|
|||||||
async function searchCategory(search) {
|
async function searchCategory(search) {
|
||||||
let res = await categoryStore.fetchCategories({ search })
|
let res = await categoryStore.fetchCategories({ search })
|
||||||
if(res.data.data.length>0 && categoryStore.editCategory) {
|
if(res.data.data.length>0 && categoryStore.editCategory) {
|
||||||
let checkCategoryExist = res.data.data.find((c) => c.id==categoryStore.editCategory.id)
|
let categoryFound = res.data.data.find((c) => c.id==categoryStore.editCategory.id)
|
||||||
if(!checkCategoryExist) {
|
if(!categoryFound) {
|
||||||
let edit_category = Object.assign({}, categoryStore.editCategory)
|
let edit_category = Object.assign({}, categoryStore.editCategory)
|
||||||
res.data.data.unshift(edit_category)
|
res.data.data.unshift(edit_category)
|
||||||
}
|
}
|
||||||
@ -428,8 +428,8 @@ async function searchCategory(search) {
|
|||||||
async function searchCustomer(search) {
|
async function searchCustomer(search) {
|
||||||
let res = await customerStore.fetchCustomers({ search })
|
let res = await customerStore.fetchCustomers({ search })
|
||||||
if(res.data.data.length>0 && customerStore.editCustomer) {
|
if(res.data.data.length>0 && customerStore.editCustomer) {
|
||||||
let checkCustomerExist = res.data.data.find((c) => c.id==customerStore.editCustomer.id)
|
let customerFound = res.data.data.find((c) => c.id==customerStore.editCustomer.id)
|
||||||
if(!checkCustomerExist) {
|
if(!customerFound) {
|
||||||
let edit_customer = Object.assign({}, customerStore.editCustomer)
|
let edit_customer = Object.assign({}, customerStore.editCustomer)
|
||||||
res.data.data.unshift(edit_customer)
|
res.data.data.unshift(edit_customer)
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ async function loadData() {
|
|||||||
customerStore.editCustomer = expenseData.data.data.customer
|
customerStore.editCustomer = expenseData.data.data.customer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (route.query.customer) {
|
} else if (route.query.customer) {
|
||||||
expenseStore.currentExpense.customer_id = route.query.customer
|
expenseStore.currentExpense.customer_id = route.query.customer
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,7 +110,7 @@ function hasActiveUrl(id) {
|
|||||||
return route.params.id == id
|
return route.params.id == id
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadInvoices(params, isScroll = false) {
|
async function loadInvoices(params, fromScrollListener = false) {
|
||||||
if (isLoading.value) {
|
if (isLoading.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -125,21 +125,21 @@ async function loadInvoices(params, isScroll = false) {
|
|||||||
|
|
||||||
currentPageNumber.value = params ? params.page : 1
|
currentPageNumber.value = params ? params.page : 1
|
||||||
lastPageNumber.value = response.data.meta.last_page
|
lastPageNumber.value = response.data.meta.last_page
|
||||||
let isInvoiceExist = invoiceList.value.find(
|
let invoiceFound = invoiceList.value.find(
|
||||||
(inv) => inv.id == route.params.id
|
(inv) => inv.id == route.params.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isScroll == false &&
|
fromScrollListener == false &&
|
||||||
!isInvoiceExist &&
|
!invoiceFound &&
|
||||||
currentPageNumber.value < lastPageNumber.value
|
currentPageNumber.value < lastPageNumber.value
|
||||||
) {
|
) {
|
||||||
loadInvoices({ page: ++currentPageNumber.value })
|
loadInvoices({ page: ++currentPageNumber.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInvoiceExist) {
|
if (invoiceFound) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isScroll == false) {
|
if (fromScrollListener == false) {
|
||||||
scrollToInvoice()
|
scrollToInvoice()
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -151,11 +151,11 @@ function scrollToInvoice() {
|
|||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: 'smooth' })
|
el.scrollIntoView({ behavior: 'smooth' })
|
||||||
el.classList.add('shake')
|
el.classList.add('shake')
|
||||||
addScrollListner()
|
addScrollListener()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addScrollListner() {
|
function addScrollListener() {
|
||||||
invoiceListSection.value.addEventListener('scroll', (ev) => {
|
invoiceListSection.value.addEventListener('scroll', (ev) => {
|
||||||
if (
|
if (
|
||||||
ev.target.scrollTop > 0 &&
|
ev.target.scrollTop > 0 &&
|
||||||
|
|||||||
@ -337,7 +337,7 @@ function hasAbilities() {
|
|||||||
|
|
||||||
const dialogStore = useDialogStore()
|
const dialogStore = useDialogStore()
|
||||||
|
|
||||||
async function loadPayments(params, isScroll = false) {
|
async function loadPayments(params, fromScrollListener = false) {
|
||||||
if (isLoading.value) {
|
if (isLoading.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -352,21 +352,21 @@ async function loadPayments(params, isScroll = false) {
|
|||||||
|
|
||||||
currentPageNumber.value = params ? params.page : 1
|
currentPageNumber.value = params ? params.page : 1
|
||||||
lastPageNumber.value = response.data.meta.last_page
|
lastPageNumber.value = response.data.meta.last_page
|
||||||
let isPaymentExist = paymentList.value.find(
|
let paymentFound = paymentList.value.find(
|
||||||
(paym) => paym.id == route.params.id
|
(paym) => paym.id == route.params.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isScroll == false &&
|
fromScrollListener == false &&
|
||||||
!isPaymentExist &&
|
!paymentFound &&
|
||||||
currentPageNumber.value < lastPageNumber.value
|
currentPageNumber.value < lastPageNumber.value
|
||||||
) {
|
) {
|
||||||
loadPayments({ page: ++currentPageNumber.value })
|
loadPayments({ page: ++currentPageNumber.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPaymentExist) {
|
if (paymentFound) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isScroll == false) {
|
if (fromScrollListener == false) {
|
||||||
scrollToPayment()
|
scrollToPayment()
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -392,11 +392,11 @@ function scrollToPayment() {
|
|||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: 'smooth' })
|
el.scrollIntoView({ behavior: 'smooth' })
|
||||||
el.classList.add('shake')
|
el.classList.add('shake')
|
||||||
addScrollListner()
|
addScrollListener()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addScrollListner() {
|
function addScrollListener() {
|
||||||
paymentListSection.value.addEventListener('scroll', (ev) => {
|
paymentListSection.value.addEventListener('scroll', (ev) => {
|
||||||
if (
|
if (
|
||||||
ev.target.scrollTop > 0 &&
|
ev.target.scrollTop > 0 &&
|
||||||
|
|||||||
@ -37,7 +37,7 @@ function hasActiveUrl(id) {
|
|||||||
return route.params.id == id
|
return route.params.id == id
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadRecurringInvoices(params, isScroll = false) {
|
async function loadRecurringInvoices(params, fromScrollListener = false) {
|
||||||
if (isLoading.value) {
|
if (isLoading.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -52,21 +52,21 @@ async function loadRecurringInvoices(params, isScroll = false) {
|
|||||||
|
|
||||||
currentPageNumber.value = params ? params.page : 1
|
currentPageNumber.value = params ? params.page : 1
|
||||||
lastPageNumber.value = response.data.meta.last_page
|
lastPageNumber.value = response.data.meta.last_page
|
||||||
let isInvoiceExist = invoiceList.value.find(
|
let invoiceFound = invoiceList.value.find(
|
||||||
(inv) => inv.id == route.params.id
|
(inv) => inv.id == route.params.id
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isScroll == false &&
|
fromScrollListener == false &&
|
||||||
!isInvoiceExist &&
|
!invoiceFound &&
|
||||||
currentPageNumber.value < lastPageNumber.value
|
currentPageNumber.value < lastPageNumber.value
|
||||||
) {
|
) {
|
||||||
loadRecurringInvoices({ page: ++currentPageNumber.value })
|
loadRecurringInvoices({ page: ++currentPageNumber.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInvoiceExist) {
|
if (invoiceFound) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isScroll == false) {
|
if (fromScrollListener == false) {
|
||||||
scrollToRecurringInvoice()
|
scrollToRecurringInvoice()
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
@ -78,11 +78,11 @@ function scrollToRecurringInvoice() {
|
|||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: 'smooth' })
|
el.scrollIntoView({ behavior: 'smooth' })
|
||||||
el.classList.add('shake')
|
el.classList.add('shake')
|
||||||
addScrollListner()
|
addScrollListener()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addScrollListner() {
|
function addScrollListener() {
|
||||||
invoiceListSection.value.addEventListener('scroll', (ev) => {
|
invoiceListSection.value.addEventListener('scroll', (ev) => {
|
||||||
if (
|
if (
|
||||||
ev.target.scrollTop > 0 &&
|
ev.target.scrollTop > 0 &&
|
||||||
|
|||||||
@ -83,8 +83,8 @@ async function searchCustomers(search) {
|
|||||||
|
|
||||||
let res = await customerStore.fetchCustomers(data)
|
let res = await customerStore.fetchCustomers(data)
|
||||||
if(res.data.data.length>0 && customerStore.editCustomer) {
|
if(res.data.data.length>0 && customerStore.editCustomer) {
|
||||||
let checkCustomerExist = res.data.data.find((c) => c.id==customerStore.editCustomer.id)
|
let customerFound = res.data.data.find((c) => c.id==customerStore.editCustomer.id)
|
||||||
if(!checkCustomerExist) {
|
if(!customerFound) {
|
||||||
let edit_customer = Object.assign({}, customerStore.editCustomer)
|
let edit_customer = Object.assign({}, customerStore.editCustomer)
|
||||||
res.data.data.unshift(edit_customer)
|
res.data.data.unshift(edit_customer)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user