feat: global option change language

This commit is contained in:
puriphatt 2024-06-24 07:21:36 +00:00
parent d3c03ef233
commit 52172b7133
5 changed files with 700 additions and 57 deletions

View file

@ -2,35 +2,677 @@
"eng": {
"gender": [
{
"label": "male",
"label": "Male",
"value": "male"
},
{
"label": "female",
"label": "Female",
"value": "female"
}
],
"training": [
{
"label": "",
"value": ""
"label": "Myanmar Labor Training Center - Mae Sot, Tak Province",
"value": "trainingTak"
},
{
"label": "สถานที่อบรมแรงงานเมียนมา-แม่สอด จ.ตาก",
"value": ""
"label": "Myanmar Labor Training Center - Kawthoung, Ranong Province",
"value": "trainingRanong"
},
{
"label": "สถานที่อบรมแรงงานเมียนมา-แม่สอด จ.ตาก",
"value": ""
"label": "Laos Labor Training Center - Nong Khai, Nong Khai Province",
"value": "trainingNongKhai"
},
{
"label": "สถานที่อบรมแรงงานเมียนมา-แม่สอด จ.ตาก",
"value": ""
"label": "Cambodian Labor Training Center - Aranyaprathet, Sa Kaeo Province",
"value": "trainingSaKaeo"
},
{
"label": "สถานที่อบรมแรงงานเมียนมา-แม่สอด จ.ตาก",
"value": ""
"label": "Cambodian Labor Training Center - Ban Laem, Chanthaburi Province",
"value": "trainingChanthaburi"
}
],
"nationality": [
{
"label": "Thai",
"value": "th"
},
{
"label": "Myanmar",
"value": "mm"
},
{
"label": "Laos",
"value": "lo"
},
{
"label": "Cambodian",
"value": "kh"
},
{
"label": "Vietnam",
"value": "vn"
}
],
"businessType": [
{
"label": "Fisheries",
"value": "fisheries"
},
{
"label": "Continuous fisheries",
"value": "continuous-fisheries"
},
{
"label": "Agriculture and livestock",
"value": "agriculture "
},
{
"label": "Construction business",
"value": "construction "
},
{
"label": "Domestic helper",
"value": "domesticHelper"
},
{
"label": "Continuous agricultural operation",
"value": "continuousAgriculture"
},
{
"label": "Continuous livestock slaughter and processing ",
"value": "continuousButchery"
},
{
"label": "Recycling business",
"value": "recycling"
},
{
"label": "Mining/quarry",
"value": "mining"
},
{
"label": "Metal products distribution",
"value": "metal"
},
{
"label": "Food and beverage distribution",
"value": "food"
},
{
"label": "Manufacture or sell products made from soil",
"value": "soilBasedProducts"
},
{
"label": "Manufacture or sell construction materials",
"value": "constructionMaterials"
},
{
"label": "Stone processing",
"value": "stone"
},
{
"label": "Manufacture or sell ready-to-wear clothing",
"value": "cloth"
},
{
"label": "Manufacture or sell plastic products",
"value": "plastic"
},
{
"label": "Manufacture or sell paper products",
"value": "paper"
},
{
"label": "Manufacture or sell electronic products",
"value": "electronics"
},
{
"label": "Transport goods by land, water, and operate warehouses",
"value": "transport"
},
{
"label": "Wholesale, retail, floating panels",
"value": "market"
},
{
"label": "Auto repair shop, car wash, and detailing",
"value": "car"
},
{
"label": "Gas station, fuel station, and service station",
"value": "fuel"
},
{
"label": "Educational institution, foundation, association, hospital",
"value": "institution"
},
{
"label": "Various services",
"value": "service"
},
{
"label": "Coordinator for Khmer, Laos, or Myanmar language services",
"value": "coordinator"
},
{
"label": "Processing seafood",
"value": "seafood"
}
],
"position": [
{
"label": "Labourer",
"value": "labourer"
},
{
"label": "Marine engine mechanic on fishing boats",
"value": "boatsMechanic"
},
{
"label": "Domestic helper",
"value": "domesticHelper"
},
{
"label": "Coordinator for Khmer, Laos, or Myanmar language services",
"value": "coordinator"
}
],
"area": [
{
"label": "Area 1: Bang Rak, Pathum Wan, Yan Nawa, and Bang Kho Laem",
"value": "area1"
},
{
"label": "Area 2: Chom Thong, Thung Khru, Bang Khun Thian, Bang Bon, and Rat Burana",
"value": "area2"
},
{
"label": "Area 3: Khlong Toei, Bang Na, Prawet, Phra Khanong, Watthana, and Suan Luang",
"value": "area3"
},
{
"label": "Area 4: Khan Na Yao, Bang Kapi, Lat Phrao, Bueng Kum, and Wang Thonglang",
"value": "area4"
},
{
"label": "Area 5: Khlong Sam Wa, Min Buri, Lat Krabang, Saphan Sung, Nong Chok, and Sai Mai",
"value": "area5"
},
{
"label": "Area 6: Khlong San, Thon Buri, Bangkok Noi, Bangkok Yai, and Bang Phlat",
"value": "area6"
},
{
"label": "Area 7: Taling Chan, Thawi Watthana, Bang Khae, Phasi Charoen, and Nong Khaem",
"value": "area7"
},
{
"label": "Area 8: Dusit, Phra Nakhon, Pom Prap Sattru Phai, and Samphanthawong",
"value": "area8"
},
{
"label": "Area 9: Chatuchak, Don Mueang, Bang Sue, Bang Khen, and Lak Si",
"value": "area9"
},
{
"label": "Area 10: Din Daeng, Phaya Thai, Ratchathewi, and Huai Khwang",
"value": "area10"
}
],
"typeImport": [
{
"label": "To submit name list of Myanmar nationals",
"value": "nameListMM"
},
{
"label": "To submit name list of Laos nationa",
"value": "nameListLO"
},
{
"label": "To submit name list of Myanmar nationa",
"value": "nameListKH"
}
],
"status": [
{
"label": "Couldn't find any information for sale",
"value": "notFound"
},
{
"label": "In progress",
"value": "inProgress"
},
{
"label": "Follow-up/additional documents",
"value": "follow"
},
{
"label": "Waiting for consideration/appointment to collect documents",
"value": "consider"
},
{
"label": "Proceeding successfully",
"value": "complete"
},
{
"label": "Service canceled",
"value": "cancel"
}
],
"delivery": [
{
"label": "E-Mail",
"value": "email"
},
{
"label": "Line",
"value": "line"
},
{
"label": "DHL",
"value": "dhl"
},
{
"label": "Van/bus",
"value": "bus"
},
{
"label": "With people to sign the contract",
"value": "person"
}
],
"typeInsurance": [
{
"label": "Private health insurance, 6 months",
"value": "6m"
},
{
"label": "Government hospital health insurance, 3 months",
"value": "3m"
},
{
"label": "Government hospital health insurance, 1 years",
"value": "1y"
},
{
"label": "Government hospital health insurance, 2 years",
"value": "2y"
}
],
"insurancePlace": [
{
"label": "Pacific Cross",
"value": "pacificcross"
},
{
"label": "Dhipaya Insurance",
"value": "dhipaya"
},
{
"label": "Lerdsin Hospital",
"value": "lerdsin"
},
{
"label": "Ratchapiphat Hospital",
"value": "ratchapipat"
},
{
"label": "Charoenkrung Pracharak Hospital",
"value": "krungPracharak"
}
],
"typeReplace": [
{
"label": "Work permit, 3 months (325)",
"value": "3m"
},
{
"label": "Work permit, 6 months (550)",
"value": "6m"
},
{
"label": "Work permit, 1 years (1000)",
"value": "1y"
},
{
"label": "Work permit, 1 year and 3 months (1225)",
"value": "1y3m"
},
{
"label": "Work permit, 1 year and 6 months (1450)",
"value": "1y6m"
},
{
"label": "Work permit, 2 years (1900)",
"value": "2y"
}
],
"checkPoint": [
{
"label": "Myanmar-Mae Sot, Tak province",
"value": "tak"
},
{
"label": "Myanmar-Kawthoung, Ranong province",
"value": "ranong"
},
{
"label": "Laos-Nong Khai, Nong Khai province",
"value": "nongKhai"
},
{
"label": "Cambodia-Aranyaprathet, Sa Kaeo province",
"value": "saKaeo"
},
{
"label": "Cambodia-Ban Laem, Chanthaburi province",
"value": "chanthaburi"
}
],
"residence": [
{
"label": "Immigration Chaengwattana",
"value": "chaengwattana"
},
{
"label": "Immigration Samutprakan",
"value": "samutPrakan"
},
{
"label": "Immigration Samutsakhon",
"value": "samutSakhon"
},
{
"label": "Immigration Nonthaburi",
"value": "nonthaburi"
},
{
"label": "Immigration Pathumthani",
"value": "pathumThani"
},
{
"label": "Immigration Nakhonpathom",
"value": "nakhonPathom"
}
],
"customerStep": [
{
"label": "Delivery channel for documents",
"value": "channel"
},
{
"label": "Customers pick up in person",
"value": "pickup"
},
{
"label": "Send by mail",
"value": "post"
},
{
"label": "Send via Line Man",
"value": "lineMan"
},
{
"label": "JOB document delivery",
"value": "job"
},
{
"label": "Immigration Nakhonpathom",
"value": "nakhonPathom"
}
],
"statusDeliver": [
{
"label": "Customer informed successfully over the phone",
"value": "reached"
},
{
"label": "Unable to contact/unable to answer the call",
"value": "cantReached"
},
{
"label": "Customer successfully received the documents",
"value": "received"
},
{
"label": "Follow-up/amend documents",
"value": "follow"
}
],
"type90days": [
{
"label": "90-day report, Bangkok (normal)",
"value": "normalBkk"
},
{
"label": "90-day report, Bangkok (overdue)",
"value": "overdueBkk"
},
{
"label": "90-day report, Up country (normal)",
"value": "nomal"
},
{
"label": "90-day report, Up country (overdue)",
"value": "overdue"
}
],
"typeInsurance2": [
{
"label": "Private health insurance, 6 months (990)",
"value": "6m"
},
{
"label": "Government hospital health insurance, 3 months (500)",
"value": "3m"
},
{
"label": "Government hospital health insurance, 1 years (2100)",
"value": "1y"
},
{
"label": "Government hospital health insurance, 2 years (4200)",
"value": "2y"
},
{
"label": "Social security benefits",
"value": "socialSecurity"
}
],
"servicePropertiesField": [
{
"label": "Service record_Name",
"value": "serviceRecordName"
},
{
"label": "RN_Service record",
"value": "serviceRecordRN"
},
{
"label": "Worker status",
"value": "workerStatus"
},
{
"label": "Contact channels",
"value": "contactChannel"
},
{
"label": "Quotation No.",
"value": "quotationNo"
},
{
"label": "Date of job reception",
"value": "startDate"
},
{
"label": "Project",
"value": "project"
},
{
"label": "Employee",
"value": "employee"
},
{
"label": "Employer",
"value": "employer"
},
{
"label": "Job sourcing area",
"value": "area"
},
{
"label": "Seller's signature",
"value": "sellerSignature"
},
{
"label": "Agent",
"value": "agent"
},
{
"label": "Contact person",
"value": "contactPerson"
},
{
"label": "Email",
"value": "email"
},
{
"label": "Telephone",
"value": "telephone"
},
{
"label": "Agency",
"value": "agency"
},
{
"label": "Remark",
"value": "remark"
},
{
"label": "Recording By",
"value": "recordBy"
}
],
"workPropertiesField": [
{
"label": "Ref No:",
"value": "refNo"
},
{
"label": "Work order number (TO)",
"value": "workOrderNo"
},
{
"label": "Purchase order date (TO)",
"value": "orderDate"
},
{
"label": "Receipt number of goods (TR)",
"value": "productReceiptNo"
},
{
"label": "Receiving goods date (TR)",
"value": "productReceiptDate"
},
{
"label": "Work Status",
"value": "workStatus"
},
{
"label": "Remark",
"value": "remark"
},
{
"label": "Factory number",
"value": "factoryNo"
},
{
"label": "Date written",
"value": "dateIssued"
},
{
"label": "Type (operation of the originating country)",
"value": "typeOriginCountryOperation"
},
{
"label": "Delivery channel",
"value": "deliveryChannel"
},
{
"label": "Name list No.",
"value": "nameListNo"
},
{
"label": "Health insurance location",
"value": "insuranceLocation"
},
{
"label": "Type (submitting application for foreigner health insurance)",
"value": "typeForeignInsurance"
},
{
"label": "Type (applying for a work permit on behalf of a foreigner)",
"value": "typePermitWorkBehalf"
},
{
"label": "Appointment date for document collection",
"value": "docPickupDate"
},
{
"label": "Calling Visa No.",
"value": "callVisaNo"
},
{
"label": "The immigration checkpoint where the worker travels",
"value": "checkpoint"
},
{
"label": "Travel date",
"value": "travelDate"
},
{
"label": "Health checkup location",
"value": "healthCheckupLocation"
},
{
"label": "Place of residence",
"value": "residenceLocation"
},
{
"label": "Next 90-day reporting",
"value": "next90Days"
},
{
"label": "Document delivery channels",
"value": "docDeliveryChannel"
},
{
"label": "Delivery status",
"value": "deliveryStatus"
},
{
"label": "Type of 90-day report",
"value": "type90Days"
}
]
},
@ -57,7 +699,7 @@
"value": "trainingRanong"
},
{
"label": " สถานที่อบรมแรงงานลาว-หนองคาย จ.หนองคาย",
"label": "สถานที่อบรมแรงงานลาว-หนองคาย จ.หนองคาย",
"value": "trainingNongKhai"
},
{
@ -112,7 +754,7 @@
},
{
"label": "ผู้รับใช้ในบ้าน",
"value": "maid"
"value": "domesticHelper"
},
{
"label": "กิจการต่อเนื่องการเกษตร",
@ -203,7 +845,7 @@
"position": [
{
"label": "กรรมกร",
"value": "worker"
"value": "labourer"
},
{
"label": "ช่างเครื่องยนต์ในเรือประมงทะเล",
@ -211,7 +853,7 @@
},
{
"label": "ผู้รับใช้ในบ้าน",
"value": "maid"
"value": "domesticHelper"
},
{
"label": "งานผู้ประสานงานด้านภาษากัมพูชา ลาว หรือเมียนมา",
@ -287,11 +929,11 @@
"value": "inProgress"
},
{
"label": "ติดตาม / เอกสารเพิ่มเติม",
"label": "ติดตาม/เอกสารเพิ่มเติม",
"value": "follow"
},
{
"label": "รอพิจารณา / นัดรับเอกสาร",
"label": "รอพิจารณา/นัดรับเอกสาร",
"value": "consider"
},
{
@ -647,7 +1289,7 @@
"value": "dateIssued"
},
{
"label": "ประเภท(การดำเนินการของประเทศต้นทาง)",
"label": "ประเภท (การดำเนินการของประเทศต้นทาง)",
"value": "typeOriginCountryOperation"
},
{
@ -667,7 +1309,7 @@
"value": "typeForeignInsurance"
},
{
"label": "ประเภท(ยื่นขอใบอนุญาตทำงานแทนคนต่างด้าว)",
"label": "ประเภท (ยื่นขอใบอนุญาตทำงานแทนคนต่างด้าว)",
"value": "typePermitWorkBehalf"
},
{

View file

@ -1,8 +1,10 @@
<script setup lang="ts">
import useUserStore from 'src/stores/user';
import useOptionStore from 'src/stores/options';
import { dateFormat } from 'src/utils/datetime';
const userStore = useUserStore();
const optionStore = useOptionStore();
const firstName = defineModel<string>('firstName');
const lastName = defineModel<string>('lastName');
@ -117,7 +119,7 @@ defineProps<{
option-label="label"
option-value="value"
v-model="gender"
:options="userStore.userOption.genderOpts"
:options="optionStore.globalOption.gender"
/>
<VueDatePicker
id="input-birth-date"
@ -189,7 +191,7 @@ defineProps<{
option-label="label"
option-value="value"
v-model="gender"
:options="userStore.userOption.genderOpts"
:options="optionStore.globalOption.gender"
:rules="[
(val: string) =>
!!val || $t('selectValidate') + $t('formDialogInputGender'),
@ -212,7 +214,7 @@ defineProps<{
option-label="label"
option-value="label"
v-model="nationality"
:options="userStore.userOption.nationalityOpts"
:options="optionStore.globalOption.nationality"
:rules="[
(val: string) =>
!!val || $t('selectValidate') + $t('formDialogInputNationality'),

View file

@ -44,6 +44,7 @@ const { visible } = storeToRefs(loaderStore);
const { locale } = useI18n({ useScope: 'global' });
const userStore = useUserStore();
const rawOption = ref();
const canvasModal = ref(false);
const leftDrawerOpen = ref(false);
const filterUnread = ref(false);
@ -127,6 +128,12 @@ watch(
() => currentLanguage.value,
() => {
localStorage.setItem('currentLanguage', currentLanguage.value);
if (rawOption.value) {
if (locale.value === 'en-US')
optionStore.globalOption = rawOption.value.eng;
if (locale.value === 'th-th')
optionStore.globalOption = rawOption.value.tha;
}
},
);
@ -143,7 +150,9 @@ onMounted(async () => {
}
const resultOption = await fetch('/option/option.json');
optionStore.globalOption = await resultOption.json();
rawOption.value = await resultOption.json();
if (locale.value === 'en-US') optionStore.globalOption = rawOption.value.eng;
if (locale.value === 'th-th') optionStore.globalOption = rawOption.value.tha;
const user = getUsername();
const uid = getUserId();

View file

@ -5,6 +5,7 @@ import { storeToRefs } from 'pinia';
import { Pagination } from 'src/stores/types';
import useCustomerStore from 'src/stores/customer';
import useEmployeeStore from 'src/stores/employee';
import useOptionStore from 'src/stores/options';
import { Status } from 'src/stores/types';
@ -74,6 +75,7 @@ const {
fetchListBranchById,
} = userCustomer;
const employeeStore = useEmployeeStore();
const optionStore = useOptionStore();
const formData = ref<CustomerCreate>({
status: 'CREATED',
personName: '',
@ -1087,9 +1089,6 @@ onMounted(async () => {
);
listEmployee.value = resultListEmployee.result;
}
const resultOption = await fetch('/option/option.json');
employeeStore.globalOption = await resultOption.json();
});
watch(locale, () => {
@ -1922,12 +1921,10 @@ watch(selectorLabel, async () => {
dense
outlined
v-model:employee-checkup="formDataEmployee.employeeCheckup"
v-model:checkup-type-option="employeeStore.globalOption.tha.nationality"
v-model:medical-benefit-option="
employeeStore.globalOption.tha.typeInsurance
"
v-model:checkup-type-option="optionStore.globalOption.nationality"
v-model:medical-benefit-option="optionStore.globalOption.typeInsurance"
v-model:insurance-company-option="
employeeStore.globalOption.tha.insurancePlace
optionStore.globalOption.insurancePlace
"
/>
<FormEmployeeWorkHistory
@ -1935,9 +1932,9 @@ watch(selectorLabel, async () => {
dense
outlined
v-model:employee-work="formDataEmployee.employeeWork"
v-model:position-name-option="employeeStore.globalOption.tha.position"
v-model:job-type-option="employeeStore.globalOption.tha.businessType"
v-model:workplace-option="employeeStore.globalOption.tha.area"
v-model:position-name-option="optionStore.globalOption.position"
v-model:job-type-option="optionStore.globalOption.businessType"
v-model:workplace-option="optionStore.globalOption.area"
/>
<FormEmployeeOther
v-if="
@ -1966,11 +1963,9 @@ watch(selectorLabel, async () => {
v-model:previous-passport-reference="
formDataEmployee.previousPassportReference
"
v-model:passport-type-option="
employeeStore.globalOption.tha.nationality
"
v-model:passport-type-option="optionStore.globalOption.nationality"
v-model:passport-issuing-country-option="
employeeStore.globalOption.tha.nationality
optionStore.globalOption.nationality
"
/>
<FormEmployeeVisa
@ -1986,7 +1981,7 @@ watch(selectorLabel, async () => {
v-model:visa-stay-until-date="formDataEmployee.visaStayUntilDate"
v-model:tm6-number="formDataEmployee.tm6Number"
v-model:entry-date="formDataEmployee.entryDate"
v-model:visa-type-option="employeeStore.globalOption.tha.nationality"
v-model:visa-type-option="optionStore.globalOption.nationality"
/>
</template>
</FormDialog>
@ -2679,7 +2674,7 @@ watch(selectorLabel, async () => {
bg-color="surface-tab"
>
<InfoForm
v-if="employeeStore.globalOption"
v-if="optionStore.globalOption"
:readonly="!infoDrawerEmployeeEdit"
:noAddress="formDataEmployeeTab !== 'personalInfo'"
:noPaddingTab="
@ -2755,14 +2750,12 @@ watch(selectorLabel, async () => {
dense
outlined
v-model:employee-checkup="formDataEmployee.employeeCheckup"
v-model:checkup-type-option="
employeeStore.globalOption.tha.nationality
"
v-model:checkup-type-option="optionStore.globalOption.nationality"
v-model:medical-benefit-option="
employeeStore.globalOption.tha.typeInsurance
optionStore.globalOption.typeInsurance
"
v-model:insurance-company-option="
employeeStore.globalOption.tha.insurancePlace
optionStore.globalOption.insurancePlace
"
/>
<FormEmployeeWorkHistory
@ -2771,9 +2764,9 @@ watch(selectorLabel, async () => {
outlined
:readonly="!infoDrawerEmployeeEdit"
v-model:employee-work="formDataEmployee.employeeWork"
v-model:position-name-option="employeeStore.globalOption.tha.position"
v-model:job-type-option="employeeStore.globalOption.tha.businessType"
v-model:workplace-option="employeeStore.globalOption.tha.area"
v-model:position-name-option="optionStore.globalOption.position"
v-model:job-type-option="optionStore.globalOption.businessType"
v-model:workplace-option="optionStore.globalOption.area"
/>
<FormEmployeeOther
v-if="
@ -2805,11 +2798,9 @@ watch(selectorLabel, async () => {
v-model:previous-passport-reference="
formDataEmployee.previousPassportReference
"
v-model:passport-type-option="
employeeStore.globalOption.tha.nationality
"
v-model:passport-type-option="optionStore.globalOption.nationality"
v-model:passport-issuing-country-option="
employeeStore.globalOption.tha.nationality
optionStore.globalOption.nationality
"
/>
<FormEmployeeVisa
@ -2826,7 +2817,7 @@ watch(selectorLabel, async () => {
v-model:visa-stay-until-date="formDataEmployee.visaStayUntilDate"
v-model:tm6-number="formDataEmployee.tm6Number"
v-model:entry-date="formDataEmployee.entryDate"
v-model:visa-type-option="employeeStore.globalOption.tha.nationality"
v-model:visa-type-option="optionStore.globalOption.nationality"
/>
</template>
</InfoForm>

View file

@ -651,12 +651,11 @@ const currentPropertiesMode = ref<'service' | 'work'>('service');
function openPropertiesDialog(type: 'service' | 'work') {
if (type === 'service') {
propertiesOption.value =
optionStore.globalOption.tha.servicePropertiesField;
propertiesOption.value = optionStore.globalOption.servicePropertiesField;
}
if (type === 'work') {
propertiesOption.value = optionStore.globalOption.tha.workPropertiesField;
propertiesOption.value = optionStore.globalOption.workPropertiesField;
}
currentPropertiesMode.value = type;