Skip to content

Commit

Permalink
FOUR-19956:Completed Task should show the form in Read only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fagubla committed Nov 4, 2024
1 parent 5e0c4e8 commit bb7ecfd
Showing 1 changed file with 40 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,40 @@
tw-float-end tw-absolute tw-right-4 tw-top-4
tw-font-semibold tw-text-gray-500 tw-shadow-sm
tw-ring-1 tw-ring-gray-300 hover:tw-bg-gray-50 tw-gap-2"
@click="onPrint">
@click="onPrint"
>
<i class="fa fa-print tw-text-gray-600" />
</button>

<transition
name="fade"
mode="in-out">
mode="in-out"
>
<div
v-show="showPlaceholder"
class="tw-flex tw-grow tw-w-full tw-h-full tw-pointer-events-none
tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-justify-center tw-items-center">
tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-justify-center tw-items-center"
>
<LoadingPlaceholder />
</div>
</transition>

<transition
name="fade"
mode="in-out">
mode="in-out"
>
<div
v-show="!showPlaceholder && screen"
class="tw-pointer-events-none">
class="tw-pointer-events-none"
>
<vue-form-renderer
v-if="screen !== null"
v-model="previewData"
:data="previewData"
:config="screen.config"
:config="configScreen"
:custom-css="screen.custom_css"
:show-errors="true" />
:show-errors="true"
/>
</div>
</transition>
</div>
Expand All @@ -54,8 +60,34 @@ const props = defineProps({
const previewData = computed(() => props.data.taskData);
const screen = ref(null);
const configScreen = ref({});
const showPlaceholder = ref(false);
const disableForm = (screenConfig) => {
if (screenConfig instanceof Array) {
for (let i = screenConfig.length - 1; i >= 0; i -= 1) {
if (
screenConfig[i].component === "FormButton"
|| screenConfig[i].component === "FileUpload"
|| screenConfig[i].component === "PhotoVideo"
) {
screenConfig.splice(i, 1);
} else {
disableForm(screenConfig[i]);
}
}
}
if (screenConfig.config !== undefined) {
screenConfig.config.disabled = true;
screenConfig.config.readonly = true;
screenConfig.config.editable = false;
}
if (screenConfig.items !== undefined) {
disableForm(screenConfig.items);
}
return screenConfig;
};
const getScreen = async (screenId) => {
showPlaceholder.value = true;
Expand All @@ -66,6 +98,7 @@ const getScreen = async (screenId) => {
if (response.data) {
screen.value = response.data;
configScreen.value = disableForm(screen.value.config);
}
}, 300);
};
Expand Down

0 comments on commit bb7ecfd

Please sign in to comment.