|
|
@@ -19,19 +19,22 @@
|
|
|
:options="kinshipOptions"
|
|
|
emit-value
|
|
|
map-options
|
|
|
- :class="dependent ? 'col-md-6 col-12' : 'col-12'"
|
|
|
+ class="col-12"
|
|
|
/>
|
|
|
- <DefaultSelect
|
|
|
- v-if="dependent"
|
|
|
- v-model="form.status"
|
|
|
- v-model:error="validationErrors.status"
|
|
|
+ <DefaultFilePicker
|
|
|
+ v-if="!dependent"
|
|
|
+ v-model="documentFile"
|
|
|
:rules="[inputRules.required]"
|
|
|
- :label="$t('common.terms.status')"
|
|
|
- :options="statusOptions"
|
|
|
- emit-value
|
|
|
- map-options
|
|
|
- class="col-md-6 col-12"
|
|
|
+ :error="!!validationErrors.document"
|
|
|
+ :error-message="validationErrors.document"
|
|
|
+ :label="$t('associado.dependent_document')"
|
|
|
+ type="file"
|
|
|
+ accept="image/*,application/pdf"
|
|
|
+ class="col-12"
|
|
|
/>
|
|
|
+ <div v-if="!dependent" class="col-12 text-caption text-grey-7">
|
|
|
+ {{ $t("associado.dependent_document_hint") }}
|
|
|
+ </div>
|
|
|
</q-card-section>
|
|
|
<q-card-actions>
|
|
|
<q-space />
|
|
|
@@ -46,7 +49,6 @@
|
|
|
:label="dependent ? $t('common.actions.save') : $t('common.actions.add')"
|
|
|
type="submit"
|
|
|
:loading="loading"
|
|
|
- :disable="!hasUpdatedFields"
|
|
|
/>
|
|
|
</q-card-actions>
|
|
|
</q-form>
|
|
|
@@ -55,7 +57,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed, useTemplateRef } from "vue";
|
|
|
+import { computed, ref, useTemplateRef } from "vue";
|
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
|
import { useDialogPluginComponent } from "quasar";
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
@@ -66,6 +68,7 @@ import { useSubmitHandler } from "src/composables/useSubmitHandler";
|
|
|
import DefaultDialogHeader from "src/components/defaults/DefaultDialogHeader.vue";
|
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
|
+import DefaultFilePicker from "src/components/defaults/DefaultFilePicker.vue";
|
|
|
|
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
|
|
|
|
@@ -91,16 +94,11 @@ const kinshipOptions = computed(() => [
|
|
|
{ label: t("associado.kinship_options.outro"), value: "outro" },
|
|
|
]);
|
|
|
|
|
|
-const statusOptions = computed(() => [
|
|
|
- { label: t("associado.dependent_statuses.approved"), value: "approved" },
|
|
|
- { label: t("associado.dependent_statuses.refused"), value: "refused" },
|
|
|
- { label: t("associado.dependent_statuses.pending"), value: "pending" },
|
|
|
-]);
|
|
|
+const documentFile = ref(null);
|
|
|
|
|
|
-const { form, getUpdatedFields, hasUpdatedFields } = useFormUpdateTracker({
|
|
|
+const { form, getUpdatedFields } = useFormUpdateTracker({
|
|
|
name: dependent?.name ?? "",
|
|
|
kinship: dependent?.kinship ?? "",
|
|
|
- status: dependent?.status ?? "pending",
|
|
|
responsible_user_id: userId,
|
|
|
});
|
|
|
|
|
|
@@ -113,7 +111,7 @@ const onOKClick = async () => {
|
|
|
if (dependent) {
|
|
|
await submitForm(() => updateDependent(dependent.id, getUpdatedFields.value));
|
|
|
} else {
|
|
|
- await submitForm(() => createDependent({ ...form }));
|
|
|
+ await submitForm(() => createDependent({ ...form, document: documentFile.value }));
|
|
|
}
|
|
|
};
|
|
|
</script>
|