|
|
@@ -151,6 +151,12 @@
|
|
|
|
|
|
</div>
|
|
|
|
|
|
+ <TermsAcceptCheckbox
|
|
|
+ v-if="!initialUser.terms_accepted_at"
|
|
|
+ v-model="termsAccepted"
|
|
|
+ class="q-mt-md"
|
|
|
+ />
|
|
|
+
|
|
|
</q-card-section>
|
|
|
|
|
|
<q-card-actions class="q-px-md q-pb-md">
|
|
|
@@ -178,6 +184,7 @@ import { userStore } from "src/stores/user";
|
|
|
import { getPositions } from "src/api/position";
|
|
|
import { getSectors } from "src/api/sector";
|
|
|
import { uploadMyAvatar, updateMyProfile } from "src/api/user";
|
|
|
+import TermsAcceptCheckbox from "src/components/TermsAcceptCheckbox.vue";
|
|
|
|
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
|
|
|
|
@@ -193,6 +200,7 @@ const localPhotoUrl = ref(null);
|
|
|
const uploadingPhoto = ref(false);
|
|
|
const saving = ref(false);
|
|
|
const positionOptions = ref([]);
|
|
|
+const termsAccepted = ref(false);
|
|
|
const sectorOptions = ref([]);
|
|
|
|
|
|
const form = ref({
|
|
|
@@ -208,6 +216,7 @@ const form = ref({
|
|
|
|
|
|
const canSave = computed(() => {
|
|
|
return (
|
|
|
+ (!!initialUser.value.terms_accepted_at || termsAccepted.value) &&
|
|
|
!!localPhotoUrl.value &&
|
|
|
!!form.value.name?.trim() &&
|
|
|
!!form.value.cpf?.trim() &&
|
|
|
@@ -246,6 +255,8 @@ const onSave = async () => {
|
|
|
if (!initialUser.value.position_id) payload.position_id = form.value.position_id;
|
|
|
if (!initialUser.value.sector_id) payload.sector_id = form.value.sector_id;
|
|
|
|
|
|
+ if (!initialUser.value.terms_accepted_at) payload.terms_accepted = 1;
|
|
|
+
|
|
|
if (Object.keys(payload).length > 0) {
|
|
|
const updated = await updateMyProfile(payload);
|
|
|
store.user = updated;
|
|
|
@@ -270,6 +281,7 @@ onMounted(async () => {
|
|
|
sector_id: user.sector_id ?? user.sector?.id ?? null,
|
|
|
registration: user.registration || null,
|
|
|
admission_date: user.admission_date || null,
|
|
|
+ terms_accepted_at: user.terms_accepted_at || null,
|
|
|
};
|
|
|
|
|
|
form.value = {
|