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