diff --git a/src/api/index.ts b/src/api/index.ts index d001eaf..bf67241 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -11,6 +11,7 @@ const config = ref({ // API_URI: "https://localhost:7260/api", API_URI: "https://bma-ehr.frappet.synology.me/api/v1", MEET_URI: "meet.frappet.com", + LINK_EVALUATE_PUBLISH: "https://bma-ehr-publish.frappet.synology.me", }, test: { API_URI: "http://localhost:5010/api/v1", @@ -21,15 +22,20 @@ const config = ref({ API_URI_ORG_TREE: "https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230707_115124.json", MEET_URI: "meet.frappet.com", + LINK_EVALUATE_PUBLISH: `${window.location.protocol}//${window.location.host}`, }, }); const API_URI = ref(config.value[env.value].API_URI); const MEET_URI = ref(config.value[env.value].MEET_URI); +const LINK_EVALUATE_PUBLISH = ref( + config.value[env.value].LINK_EVALUATE_PUBLISH +); export default { env: env.value, config: config.value, API_URI: API_URI.value, MEET_URI: MEET_URI.value, + LINK_EVALUATE_PUBLISH: LINK_EVALUATE_PUBLISH.value, }; diff --git a/src/modules/06_evaluate/components/step/step6.vue b/src/modules/06_evaluate/components/step/step6.vue index 44b5a37..629c471 100644 --- a/src/modules/06_evaluate/components/step/step6.vue +++ b/src/modules/06_evaluate/components/step/step6.vue @@ -139,8 +139,13 @@ async function fetchCheckDate() { .get(config.API.evaluationCheckDate(props.evaluateId)) .then((res) => { const data = res.data.result; - dateStartPrepareDoc2.value = date2Thai(data.dateStartPrepareDoc2); - dateEndPrepareDoc2.value = date2Thai(data.dateEndPrepareDoc2); + // dateStartPrepareDoc2.value = date2Thai(data.dateStartPrepareDoc2); + const endDate = new Date(data.dateStartAnnounce); + endDate.setDate(endDate.getDate() + 210); + dateEndPrepareDoc2.value = date2Thai(endDate); + dateEndPrepareDoc2.value = data.dateEndPrepareDoc2 + ? date2Thai(data.dateEndPrepareDoc2) + : dateEndPrepareDoc2.value; }) .catch((err) => {})); } diff --git a/src/modules/06_evaluate/components/step/step9.vue b/src/modules/06_evaluate/components/step/step9.vue index 04d4eea..1fb27dd 100644 --- a/src/modules/06_evaluate/components/step/step9.vue +++ b/src/modules/06_evaluate/components/step/step9.vue @@ -4,33 +4,38 @@ import { useQuasar } from "quasar"; import { useEvaluateStore } from "@/modules/06_evaluate/store"; import { useCounterMixin } from "@/stores/mixin"; +import env from "@/api"; const mixin = useCounterMixin(); const stroe = useEvaluateStore(); const $q = useQuasar(); const { success } = mixin; -const link = ref( - `https://bma-ehr-publish.frappet.synology.me/${stroe.evaluateId}` -); +const link = ref(env.LINK_EVALUATE_PUBLISH); -async function onClickCopyLink() { - const textarea = document.createElement("textarea"); - textarea.value = link.value; - document.body.appendChild(textarea); - textarea.select(); - document.execCommand("copy"); - success($q, "คัดลอกลิ้งค์สำเร็จ"); +function copyLink() { + const linkById = `${link.value}/${stroe.evaluateId}`; + navigator.clipboard.writeText(linkById); + success($q, "คัดลอกสำเร็จ"); } + +// async function onClickCopyLink() { +// const textarea = document.createElement("textarea"); +// textarea.value = link.value; +// document.body.appendChild(textarea); +// textarea.select(); +// document.execCommand("copy"); +// success($q, "คัดลอกลิ้งค์สำเร็จ"); +// }