Gustavo Zanatta пре 1 дан
родитељ
комит
961c4fb0ba
3 измењених фајлова са 27 додато и 1 уклоњено
  1. 5 0
      src/api/customSchedules.js
  2. 18 1
      src/helpers/utils.js
  3. 4 0
      src/pages/dashboard/DashboardPage.vue

+ 5 - 0
src/api/customSchedules.js

@@ -3,4 +3,9 @@ import api from 'src/api'
 export const createCustomSchedule = async (payload) => {
   const { data } = await api.post('/custom-schedule', payload)
   return data
+}
+
+export const acceptProposal = async (proposalId) => {
+  const response = await api.post(`/custom-schedule/${proposalId}/accept`)
+  return response.data
 }

+ 18 - 1
src/helpers/utils.js

@@ -314,6 +314,22 @@ const calculateDailyPrices = (dailyPrice8h) => {
   };
 };
 
+const chooseprice = (periodType, daily_price_8h) => {
+  let alldaily_prices = calculateDailyPrices(daily_price_8h);
+  switch (periodType) {
+    case "8":
+      return daily_price_8h
+    case "6":
+      return alldaily_prices.daily_price_6h
+    case "4":
+      return alldaily_prices.daily_price_4h
+    case "2":
+      return alldaily_prices.daily_price_2h
+    default:
+      return 0
+  }
+}
+
 export {
   formatDateDMYtoYMD,
   formatDateYMDtoDMY,
@@ -331,5 +347,6 @@ export {
   detectCardBrand,
   validateCardExpiration,
   formatAddress,
-  calculateDailyPrices
+  calculateDailyPrices,
+  chooseprice
 };

+ 4 - 0
src/pages/dashboard/DashboardPage.vue

@@ -16,6 +16,7 @@
       />
       <DashboardTodaySchedules v-if="todaySchedules.length > 0" :data="todaySchedules" @rate="openRatingDialog" />
       <DashboardScrollAreaSchedules />
+      <DashboardClientProposals :data="clientProposals" />
       <DashboardPendingCustomSchedules />
       <DashboardNextSchedules v-if="nextSchedules.length > 0" :data="nextSchedules" @view-details="openNextScheduleDialog" />
       <DashboardLastDoneSchedules v-if="lastDoneSchedules.length > 0" :data="lastDoneSchedules" />
@@ -38,6 +39,7 @@ import DashboardProvidersClose from 'src/components/dashboard/DashboardProviders
 import DashboardTodaySchedules from 'src/components/dashboard/DashboardTodaySchedules.vue';
 import FinalSuccesModal from '../schedules/components/FinalSuccesModal.vue';
 import DashboardPendingCustomSchedules from 'src/pages/dashboard/components/DashboardPendingCustomSchedules.vue';
+import DashboardClientProposals from 'src/pages/dashboard/components/DashboardClientProposals.vue';
 import { useRouter } from 'vue-router'
 import { onMounted, ref } from 'vue';
 import { useDialogPluginComponent, useQuasar } from 'quasar';
@@ -51,6 +53,7 @@ const headerBar = ref({});
 const summaryInfos = ref({});
 const pendingSchedules = ref([]);
 const nextSchedules = ref([]);
+const clientProposals = ref([]);
 const lastDoneSchedules = ref([]);
 const favoriteProviders = ref([]);
 const providersClose = ref([]);
@@ -81,6 +84,7 @@ const reloadDashboard = async () => {
     lastDoneSchedules.value = response.lastDoneSchedules ?? [];
     favoriteProviders.value = response.favoriteProviders ?? [];
     providersClose.value = response.providersClose ?? [];
+    clientProposals.value = response.schedulesProposals ?? [];
     todaySchedules.value = response.todaySchedules ?? [];
   }
   if( showSuccessModal.value ) {