浏览代码

various fixes

Olivier Massot 2 年之前
父节点
当前提交
9ad454f693

+ 6 - 11
components/Layout/SubHeader/DataTimingRange.vue

@@ -7,7 +7,7 @@
 
       <UiInputDateRangePicker
           :model-value="datesRange"
-          max-height="28"
+          :max-height="28"
           @update:model-value="updateDateTimeRange"
       />
     </div>
@@ -37,7 +37,6 @@ import {WatchStopHandle} from "@vue/runtime-core";
 import {useEntityManager} from "~/composables/data/useEntityManager";
 import Access from "~/models/Access/Access";
 import DateUtils from "~/services/utils/dateUtils";
-import formatISO from 'date-fns/formatISO'
 
 const btn: Ref = ref(null)
 const show: Ref<boolean> = ref(false)
@@ -46,8 +45,6 @@ const { setDirty } = useFormStore()
 const accessProfileStore = useAccessProfileStore()
 const { em } = useEntityManager()
 
-
-
 const start = accessProfileStore.historical.dateStart
 const end = accessProfileStore.historical.dateStart
 
@@ -65,20 +62,18 @@ const updateDateTimeRange = async (dates: Array<Date>): Promise<any> => {
   }
 
   accessProfileStore.setHistoricalRange(
-      formatISO(datesRange.value[0], { representation: 'date' }),
-      formatISO(datesRange.value[1], { representation: 'date' })
+      DateUtils.formatIsoShortDate(datesRange.value[0]),
+      DateUtils.formatIsoShortDate(datesRange.value[1])
   )
   setDirty(false)
 
-  const access = await em.fetch(Access, accessProfileStore.id)
-
-  const settings = access.setting
-  settings.historical = accessProfileStore.historical
+  console.log(accessProfileStore.id)
+  console.log({'historical': accessProfileStore.historical})
 
   await em.patch(
       Access,
       accessProfileStore.id,
-      {'setting': settings}
+      {'historical': accessProfileStore.historical}
   )
 
   window.location.reload()

+ 1 - 2
components/Ui/Input/DateRangePicker.vue

@@ -5,7 +5,7 @@
       range
       multi-calendars
       :auto-apply="autoApply"
-      :locale="i18n.locale"
+      :locale="i18n.locale.value"
       :format-locale="fnsLocale"
       :format="dateFormatPattern"
       :start-date="today"
@@ -49,7 +49,6 @@ const updateDateTimeRange = (value: [string, string]) => {
 
 const i18n = useI18n()
 
-
 const fnsLocale = DateUtils.getFnsLocale(i18n.locale.value as supportedLocales)
 const dateFormatPattern = DateUtils.getShortFormatPattern(i18n.locale.value as supportedLocales)
 

+ 2 - 1
lang/fr.json

@@ -571,5 +571,6 @@
   "READY": "Prêt",
   "DELETED": "Supprimé",
   "ERROR": "Erreur",
-  "select": "Sélectionner"
+  "select": "Sélectionner",
+  "Internal Server Error": "Erreur de serveur interne"
 }

+ 3 - 0
pages/poc/blank.vue

@@ -1,4 +1,7 @@
 <template>
+  <div>
+    ...
+  </div>
 </template>
 
 <script setup lang="ts">

+ 4 - 0
services/utils/dateUtils.ts

@@ -49,4 +49,8 @@ export default class DateUtils {
       'fr': 'dd/MM/yyyy'
     }[code]
   }
+
+  public static formatIsoShortDate(date: Date): string {
+    return format(date, 'yyyy-MM-dd')
+  }
 }