浏览代码

ajustes edicao custom schedule + bloqueio preencher codigo se ja tiver preenchido

Gustavo Zanatta 4 天之前
父节点
当前提交
d06cab5d59

+ 13 - 5
src/pages/opportunity/components/AddEditCustomScheduleDialog.vue

@@ -132,7 +132,6 @@
             :error="!!serverErrors?.date"
             :error-message="serverErrors?.date"
             class="col-12"
-            @update:untreated-date="updateAvailableTimeSlots"
           />
 
           <div v-show="formData.period_type && formData.date" class="col-12">
@@ -278,9 +277,9 @@ const availableTimeSlots = computed(() => {
   const slots = []
 
   for (let hour = 7; hour <= 20 - period; hour++) {
-    const startTime = `${hour.toString().padStart(2, '0')}:00:00`
+    const startTime = `${hour.toString().padStart(2, '0')}:00`
     const endHour = hour + period
-    const endTime = `${endHour.toString().padStart(2, '0')}:00:00`
+    const endTime = `${endHour.toString().padStart(2, '0')}:00`
     const slotValue = `${startTime}|${endTime}`
 
     slots.push({
@@ -309,6 +308,8 @@ const handleRemoveSpeciality = (index) => {
 }
 
 const onClientChange = (client) => {
+  if(!isMounted.value) return
+  if(client?.value == formData.client_id) return
   formData.client_id = client?.value || null
   formData.address_id = null
   selectedAddress.value = null
@@ -316,17 +317,24 @@ const onClientChange = (client) => {
 }
 
 const onAddressChange = (address) => {
+  if(!isMounted.value) return
+  if(address?.value == formData.address_id) return
   formData.address_id = address?.value || null
   serverErrors.address_id = null
 }
 
 const onServiceTypeChange = (serviceType) => {
+  if(!isMounted.value) return
+  if(serviceType?.value == formData.service_type_id) return
   formData.service_type_id = serviceType?.value || null
   serverErrors.service_type_id = null
 }
 
-const onAddressTypeChange = () => {
+const onAddressTypeChange = (addressType) => {
+  if(!isMounted.value) return
+  if(addressType?.value == formData.address_type) return
   formData.address_id = null
+  formData.address_type = addressType || null
   selectedAddress.value = null
 }
 
@@ -394,6 +402,6 @@ watch(
 
 onMounted(async () => {
   await loadSpecialities()
-  isMounted.value = true
+  isMounted.value = true;
 })
 </script>

+ 1 - 1
src/pages/opportunity/components/ViewCustomScheduleDialog.vue

@@ -217,7 +217,7 @@
           @click="handleMarkAsPaid"
         />
         <q-btn
-          v-if="(schedule?.status === 'paid' || schedule?.status === 'started' ) && viewMode == 'provider'"
+          v-if="(schedule?.status === 'paid' || schedule?.status === 'started' ) && viewMode == 'provider' && !schedule.code_verified"
           unelevated
           :label="$t('schedules.fill_code')"
           color="secondary"