add: calendar view & calculator view
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { getCompany } from "../services/company";
|
||||
import { getBudgets, getCompany } from "../services/company";
|
||||
import api from "../lib/axios";
|
||||
|
||||
export const useCompanyStore = defineStore('company', () => {
|
||||
|
||||
const companyid = localStorage.getItem('id');
|
||||
const company = ref(null)
|
||||
const budgets = ref([]);
|
||||
const proposals = ref([])
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -43,10 +44,38 @@ export const useCompanyStore = defineStore('company', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const getBudgetsCompany = async(filterQuery, reload = false) => {
|
||||
let filterArr = Object.values(filterQuery);
|
||||
|
||||
let cleanfilterArr = filterArr.filter(n=>n);
|
||||
// console.log(cleanfilterArr);
|
||||
var filterStr = "";
|
||||
if(cleanfilterArr.length >0){
|
||||
filterStr ="?"+cleanfilterArr.join("&");
|
||||
}
|
||||
|
||||
console.log(filterStr);
|
||||
|
||||
if(budgets.value.length <= 0 || reload === true) {
|
||||
try {
|
||||
const data = await getBudgets(filterStr);
|
||||
if(data.total > 0) {
|
||||
budgets.value = data.data;
|
||||
} else {
|
||||
budgets.value = [];
|
||||
}
|
||||
} catch (error) {
|
||||
budgets.value = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
getCompanyData,
|
||||
getProposalsCompany,
|
||||
getBudgetsCompany,
|
||||
budgets,
|
||||
clear,
|
||||
loading,
|
||||
proposals,
|
||||
|
||||
Reference in New Issue
Block a user