Przeglądaj źródła

fix botoes cancelar

Gustavo Zanatta 1 tydzień temu
rodzic
commit
8aa1f6a48f

+ 4 - 2
src/components/login/LoginStep1Panel.vue

@@ -8,7 +8,8 @@
 
     <q-input
       v-model="email"
-      class="bg-surface q-mt-sm"
+      bg-color="surface"
+      class="q-mt-sm"
       hide-bottom-space
       input-class="font12 fontmedium text-text"
       lazy-rules
@@ -50,7 +51,8 @@
 
       <q-input
         v-model="phone"
-        class="bg-surface q-mt-sm"
+        bg-color="surface"
+        class="q-mt-sm"
         hide-bottom-space
         input-class="text-text"
         lazy-rules

+ 4 - 1
src/pages/dashboard/components/schedule/NextSchedulesDetailsDialog.vue

@@ -206,7 +206,8 @@ const props = defineProps({
 });
 
 const $q = useQuasar();
-const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent();
+const { dialogRef, onDialogHide, onDialogCancel, onDialogOK } =
+  useDialogPluginComponent();
 const { platformFees, loadPlatformFees } = usePaymentPlatformFees();
 const { t } = useI18n();
 
@@ -273,6 +274,8 @@ const openCancelDialog = () => {
   $q.dialog({
     component: ScheduleCancelDialog,
     componentProps: { schedule: props.schedule },
+  }).onOk(() => {
+    onDialogOK({ action: "cancelled", id: props.schedule.id });
   });
 };
 

+ 28 - 1
src/pages/dashboard/components/schedule/ScheduleAcceptedDialog.vue

@@ -156,7 +156,7 @@
           no-caps
           padding="4px 12px"
           :label="$t('dashboard_client.pending_schedules.btn_cancel')"
-          @click="onDialogHide"
+          @click="onCancelOrder"
         />
       </q-card-section>
     </q-card>
@@ -179,6 +179,7 @@ import { useDialogPluginComponent, useQuasar } from "quasar";
 import { usePaymentPlatformFees } from "src/composables/usePaymentPlatformFees";
 import { usePaymentStore } from "src/stores/payment";
 
+import ScheduleCancelDialog from "./ScheduleCancelDialog.vue";
 import SchedulePaymentDialog from "./SchedulePaymentDialog.vue";
 import SchedulePaymentPixDialog from "./SchedulePaymentPixDialog.vue";
 
@@ -262,6 +263,32 @@ const onGoToPayment = () => {
   });
 };
 
+const onCancelOrder = () => {
+  const scheduleToCancel = activeSchedules.value[0];
+
+  if (!scheduleToCancel) {
+    onDialogHide();
+
+    return;
+  }
+
+  $q.dialog({
+    component: ScheduleCancelDialog,
+    componentProps: {
+      schedule: {
+        ...scheduleToCancel,
+        service_package_id:
+          scheduleToCancel.service_package_id ?? item.value.id,
+        service_package_items_count:
+          scheduleToCancel.service_package_items_count ??
+          activeSchedules.value.length,
+      },
+    },
+  }).onOk(() => {
+    onDialogOK();
+  });
+};
+
 onMounted(() => {
   loadPlatformFees().catch(() => {});
 });

+ 2 - 2
src/pages/dashboard/components/schedule/ScheduleCancelDialog.vue

@@ -102,7 +102,7 @@ const props = defineProps({
 })
 
 const $q = useQuasar()
-const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent()
+const { dialogRef, onDialogHide, onDialogCancel, onDialogOK } = useDialogPluginComponent()
 const { t } = useI18n()
 
 const cancelText = ref('')
@@ -127,7 +127,7 @@ const confirmCancel = async () => {
   loading.value = true
   try {
     await cancelSchedule(props.schedule.id, cancelText.value.trim())
-    dialogRef.value.hide()
+    onDialogOK()
   } catch {
     $q.notify({ message: t('http.errors.failed'), color: 'negative' })
   } finally {

+ 9 - 3
src/pages/orders/ServicePackagePage.vue

@@ -254,6 +254,7 @@
         :key="entry.schedule.id"
         :proposals-count="entry.proposalsCount"
         :schedule="entry.schedule"
+        @cancelled="loadOrders"
       />
     </div>
 
@@ -365,14 +366,15 @@ import DashboardClientProposals from "src/pages/dashboard/components/DashboardCl
 import DashboardPendingSchedules from "src/components/dashboard/DashboardPendingSchedules.vue";
 import CustomScheduleRequestCard from "src/pages/orders/components/CustomScheduleRequestCard.vue";
 import PackageScheduleDetailsDialog from "src/components/dashboard/PackageScheduleDetailsDialog.vue";
-import ScheduleAcceptedDialog from "src/components/dashboard/ScheduleAcceptedDialog.vue";
-import ScheduleCancelDialog from "src/components/dashboard/ScheduleCancelDialog.vue";
+import ScheduleAcceptedDialog from "src/pages/dashboard/components/schedule/ScheduleAcceptedDialog.vue";
+import ScheduleCancelDialog from "src/pages/dashboard/components/schedule/ScheduleCancelDialog.vue";
 import { createScheduleServicePackage } from "src/api/servicePackage";
 import { dadosPedidosCliente } from "src/api/dashboard";
 import { getAddresses } from "src/api/address";
 import { getProfileMediaUrl } from "src/helpers/profileMedia";
 import { useI18n } from "vue-i18n";
 import { usePaymentPlatformFees } from "src/composables/usePaymentPlatformFees";
+import { usePaymentStore } from "src/stores/payment";
 import { useQuasar } from "quasar";
 import { useRouter } from "vue-router";
 import { userStore } from "src/stores/user";
@@ -383,6 +385,7 @@ const router = useRouter();
 const $q = useQuasar();
 const { platformFees, loadPlatformFees } = usePaymentPlatformFees();
 
+const paymentStore = usePaymentStore();
 const servicePackage = useServicePackageStore();
 const store = userStore();
 
@@ -433,11 +436,14 @@ const hasPendingDefaultSchedules = computed(
 );
 
 const openServicePackagePaymentDialog = (packageToPay) => {
+  paymentStore.setPackage(packageToPay);
+
   $q.dialog({
     component: ScheduleAcceptedDialog,
-    componentProps: { servicePackage: packageToPay },
   }).onOk(() => {
     loadOrders();
+  }).onDismiss(() => {
+    paymentStore.clearPackage();
   });
 };
 

+ 4 - 0
src/pages/orders/components/CustomScheduleRequestCard.vue

@@ -89,6 +89,8 @@ const props = defineProps({
   },
 });
 
+const emit = defineEmits(["cancelled"]);
+
 const $q = useQuasar();
 
 const hasProposals = computed(() => props.proposalsCount > 0);
@@ -97,6 +99,8 @@ const openDetailsDialog = () => {
   $q.dialog({
     component: NextSchedulesDetailsDialog,
     componentProps: { schedule: props.schedule },
+  }).onOk(({ action } = {}) => {
+    if (action === "cancelled") emit("cancelled");
   });
 };