@fctc/widget-logic 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -641,8 +641,8 @@ var require_moment = __commonJS({
641
641
  tokens[token2](input, config._a, config, token2);
642
642
  }
643
643
  }
644
- function isLeapYear(year2) {
645
- return year2 % 4 === 0 && year2 % 100 !== 0 || year2 % 400 === 0;
644
+ function isLeapYear(year) {
645
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
646
646
  }
647
647
  var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
648
648
  addFormatToken("Y", 0, 0, function() {
@@ -670,8 +670,8 @@ var require_moment = __commonJS({
670
670
  addParseToken("Y", function(input, array) {
671
671
  array[YEAR] = parseInt(input, 10);
672
672
  });
673
- function daysInYear(year2) {
674
- return isLeapYear(year2) ? 366 : 365;
673
+ function daysInYear(year) {
674
+ return isLeapYear(year) ? 366 : 365;
675
675
  }
676
676
  hooks.parseTwoDigitYear = function(input) {
677
677
  return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
@@ -718,7 +718,7 @@ var require_moment = __commonJS({
718
718
  }
719
719
  }
720
720
  function set$1(mom, unit, value) {
721
- var d, isUTC, year2, month2, date;
721
+ var d, isUTC, year, month, date;
722
722
  if (!mom.isValid() || isNaN(value)) {
723
723
  return;
724
724
  }
@@ -745,11 +745,11 @@ var require_moment = __commonJS({
745
745
  default:
746
746
  return;
747
747
  }
748
- year2 = value;
749
- month2 = mom.month();
748
+ year = value;
749
+ month = mom.month();
750
750
  date = mom.date();
751
- date = date === 29 && month2 === 1 && !isLeapYear(year2) ? 28 : date;
752
- void (isUTC ? d.setUTCFullYear(year2, month2, date) : d.setFullYear(year2, month2, date));
751
+ date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
752
+ void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
753
753
  }
754
754
  function stringGet(units) {
755
755
  units = normalizeUnits(units);
@@ -790,13 +790,13 @@ var require_moment = __commonJS({
790
790
  return -1;
791
791
  };
792
792
  }
793
- function daysInMonth(year2, month2) {
794
- if (isNaN(year2) || isNaN(month2)) {
793
+ function daysInMonth(year, month) {
794
+ if (isNaN(year) || isNaN(month)) {
795
795
  return NaN;
796
796
  }
797
- var modMonth = mod(month2, 12);
798
- year2 += (month2 - modMonth) / 12;
799
- return modMonth === 1 ? isLeapYear(year2) ? 29 : 28 : 31 - modMonth % 7 % 2;
797
+ var modMonth = mod(month, 12);
798
+ year += (month - modMonth) / 12;
799
+ return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
800
800
  }
801
801
  addFormatToken("M", ["MM", 2], "Mo", function() {
802
802
  return this.month() + 1;
@@ -819,9 +819,9 @@ var require_moment = __commonJS({
819
819
  array[MONTH] = toInt(input) - 1;
820
820
  });
821
821
  addParseToken(["MMM", "MMMM"], function(input, array, config, token2) {
822
- var month2 = config._locale.monthsParse(input, token2, config._strict);
823
- if (month2 != null) {
824
- array[MONTH] = month2;
822
+ var month = config._locale.monthsParse(input, token2, config._strict);
823
+ if (month != null) {
824
+ array[MONTH] = month;
825
825
  } else {
826
826
  getParsingFlags(config).invalidMonth = input;
827
827
  }
@@ -931,9 +931,9 @@ var require_moment = __commonJS({
931
931
  }
932
932
  }
933
933
  }
934
- var month2 = value, date = mom.date();
935
- date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month2));
936
- void (mom._isUTC ? mom._d.setUTCMonth(month2, date) : mom._d.setMonth(month2, date));
934
+ var month = value, date = mom.date();
935
+ date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
936
+ void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
937
937
  return mom;
938
938
  }
939
939
  function getSetMonth(value) {
@@ -1036,20 +1036,20 @@ var require_moment = __commonJS({
1036
1036
  }
1037
1037
  return date;
1038
1038
  }
1039
- function firstWeekOffset(year2, dow, doy) {
1040
- var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year2, 0, fwd).getUTCDay() - dow) % 7;
1039
+ function firstWeekOffset(year, dow, doy) {
1040
+ var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
1041
1041
  return -fwdlw + fwd - 1;
1042
1042
  }
1043
- function dayOfYearFromWeeks(year2, week, weekday, dow, doy) {
1044
- var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year2, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
1043
+ function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
1044
+ var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
1045
1045
  if (dayOfYear <= 0) {
1046
- resYear = year2 - 1;
1046
+ resYear = year - 1;
1047
1047
  resDayOfYear = daysInYear(resYear) + dayOfYear;
1048
- } else if (dayOfYear > daysInYear(year2)) {
1049
- resYear = year2 + 1;
1050
- resDayOfYear = dayOfYear - daysInYear(year2);
1048
+ } else if (dayOfYear > daysInYear(year)) {
1049
+ resYear = year + 1;
1050
+ resDayOfYear = dayOfYear - daysInYear(year);
1051
1051
  } else {
1052
- resYear = year2;
1052
+ resYear = year;
1053
1053
  resDayOfYear = dayOfYear;
1054
1054
  }
1055
1055
  return {
@@ -1074,9 +1074,9 @@ var require_moment = __commonJS({
1074
1074
  year: resYear
1075
1075
  };
1076
1076
  }
1077
- function weeksInYear(year2, dow, doy) {
1078
- var weekOffset = firstWeekOffset(year2, dow, doy), weekOffsetNext = firstWeekOffset(year2 + 1, dow, doy);
1079
- return (daysInYear(year2) - weekOffset + weekOffsetNext) / 7;
1077
+ function weeksInYear(year, dow, doy) {
1078
+ var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
1079
+ return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
1080
1080
  }
1081
1081
  addFormatToken("w", ["ww", 2], "wo", "week");
1082
1082
  addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
@@ -1294,12 +1294,12 @@ var require_moment = __commonJS({
1294
1294
  if (!this.isValid()) {
1295
1295
  return input != null ? this : NaN;
1296
1296
  }
1297
- var day2 = get(this, "Day");
1297
+ var day = get(this, "Day");
1298
1298
  if (input != null) {
1299
1299
  input = parseWeekday(input, this.localeData());
1300
- return this.add(input - day2, "d");
1300
+ return this.add(input - day, "d");
1301
1301
  } else {
1302
- return day2;
1302
+ return day;
1303
1303
  }
1304
1304
  }
1305
1305
  function getSetLocaleDayOfWeek(input) {
@@ -1796,13 +1796,13 @@ var require_moment = __commonJS({
1796
1796
  return result;
1797
1797
  }
1798
1798
  function untruncateYear(yearStr) {
1799
- var year2 = parseInt(yearStr, 10);
1800
- if (year2 <= 49) {
1801
- return 2e3 + year2;
1802
- } else if (year2 <= 999) {
1803
- return 1900 + year2;
1799
+ var year = parseInt(yearStr, 10);
1800
+ if (year <= 49) {
1801
+ return 2e3 + year;
1802
+ } else if (year <= 999) {
1803
+ return 1900 + year;
1804
1804
  }
1805
- return year2;
1805
+ return year;
1806
1806
  }
1807
1807
  function preprocessRFC2822(s) {
1808
1808
  return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
@@ -2836,16 +2836,16 @@ var require_moment = __commonJS({
2836
2836
  if (!this.isValid()) {
2837
2837
  return "moment.invalid(/* " + this._i + " */)";
2838
2838
  }
2839
- var func = "moment", zone = "", prefix, year2, datetime, suffix;
2839
+ var func = "moment", zone = "", prefix, year, datetime, suffix;
2840
2840
  if (!this.isLocal()) {
2841
2841
  func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
2842
2842
  zone = "Z";
2843
2843
  }
2844
2844
  prefix = "[" + func + '("]';
2845
- year2 = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
2845
+ year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
2846
2846
  datetime = "-MM-DD[T]HH:mm:ss.SSS";
2847
2847
  suffix = zone + '[")]';
2848
- return this.format(prefix + year2 + datetime + suffix);
2848
+ return this.format(prefix + year + datetime + suffix);
2849
2849
  }
2850
2850
  function format(inputString) {
2851
2851
  if (!inputString) {
@@ -3184,12 +3184,12 @@ var require_moment = __commonJS({
3184
3184
  }
3185
3185
  }
3186
3186
  }
3187
- function localeErasConvertYear(era, year2) {
3187
+ function localeErasConvertYear(era, year) {
3188
3188
  var dir = era.since <= era.until ? 1 : -1;
3189
- if (year2 === void 0) {
3189
+ if (year === void 0) {
3190
3190
  return hooks(era.since).year();
3191
3191
  } else {
3192
- return hooks(era.since).year() + (year2 - era.offset) * dir;
3192
+ return hooks(era.since).year() + (year - era.offset) * dir;
3193
3193
  }
3194
3194
  }
3195
3195
  function getEraName() {
@@ -4036,6 +4036,7 @@ var index_exports = {};
4036
4036
  __export(index_exports, {
4037
4037
  API_APP_URL: () => API_APP_URL,
4038
4038
  API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
4039
+ AppProvider: () => AppProvider,
4039
4040
  CloseIcon: () => CloseIcon,
4040
4041
  EyeIcon: () => EyeIcon,
4041
4042
  LoadingIcon: () => LoadingIcon,
@@ -4062,17 +4063,22 @@ __export(index_exports, {
4062
4063
  priorityFieldController: () => priorityFieldController,
4063
4064
  setStorageItemAsync: () => setStorageItemAsync,
4064
4065
  statusDropdownController: () => statusDropdownController,
4066
+ useAppProvider: () => useAppProvider,
4065
4067
  useAuth: () => useAuth,
4066
4068
  useCallAction: () => useCallAction,
4067
4069
  useClickOutside: () => useClickOutside,
4068
4070
  useConfig: () => useConfig,
4069
4071
  useDebounce: () => useDebounce,
4070
4072
  useDetail: () => useDetail,
4073
+ useForgotPasswordHandler: () => useForgotPasswordHandler,
4071
4074
  useGetRowIds: () => useGetRowIds,
4072
4075
  useListData: () => useListData,
4076
+ useLoginHandler: () => useLoginHandler,
4073
4077
  useMenu: () => useMenu,
4074
4078
  useProfile: () => useProfile,
4079
+ useResetPasswordHandler: () => useResetPasswordHandler,
4075
4080
  useStorageState: () => useStorageState,
4081
+ useSwitchLocaleHandler: () => useSwitchLocaleHandler,
4076
4082
  useUser: () => useUser,
4077
4083
  useViewV2: () => useViewV2
4078
4084
  });
@@ -4670,8 +4676,125 @@ var useAuth = () => {
4670
4676
  };
4671
4677
  };
4672
4678
 
4673
- // src/hooks/utils/use-click-outside.ts
4679
+ // src/hooks/core/use-app-provider.tsx
4680
+ var import_react10 = require("react");
4681
+
4682
+ // src/hooks/core/use-company.ts
4683
+ var import_interface_logic9 = require("@fctc/interface-logic");
4684
+ var import_react_query3 = require("@tanstack/react-query");
4674
4685
  var import_react9 = require("react");
4686
+ var useCompany = (accessToken) => {
4687
+ const getCurrentCompany = (0, import_interface_logic9.useGetCurrentCompany)();
4688
+ const fetchCurrentCompany = async () => {
4689
+ return await getCurrentCompany.mutateAsync();
4690
+ };
4691
+ const currentCompany = (0, import_react_query3.useQuery)({
4692
+ queryKey: ["currentCompany", accessToken],
4693
+ queryFn: fetchCurrentCompany,
4694
+ enabled: !!accessToken
4695
+ });
4696
+ const current_company_id = (0, import_react9.useMemo)(() => {
4697
+ return currentCompany.data?.current_company_id;
4698
+ }, [currentCompany.data]);
4699
+ (0, import_react9.useEffect)(() => {
4700
+ if (current_company_id) {
4701
+ const companyIDs = [current_company_id];
4702
+ const env = (0, import_interface_logic9.getEnv)();
4703
+ env.setAllowCompanies([...companyIDs]);
4704
+ env.setCompanies(companyIDs);
4705
+ }
4706
+ }, [current_company_id]);
4707
+ const getCompanyInfo = (0, import_interface_logic9.useGetCompanyInfo)();
4708
+ const companyInfo = (0, import_react_query3.useQuery)({
4709
+ queryKey: ["companyInfoQuery", current_company_id, accessToken],
4710
+ queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
4711
+ enabled: !!current_company_id && !!accessToken
4712
+ });
4713
+ (0, import_react9.useEffect)(() => {
4714
+ if (companyInfo.data) {
4715
+ const companyInfoData = companyInfo.data;
4716
+ if (companyInfoData?.length) {
4717
+ const env = (0, import_interface_logic9.getEnv)();
4718
+ env.setDefaultCompany(companyInfoData[0]);
4719
+ }
4720
+ }
4721
+ }, [companyInfo.data]);
4722
+ return {
4723
+ currentCompany,
4724
+ companyInfo,
4725
+ context: { allowed_company_ids: [current_company_id] }
4726
+ };
4727
+ };
4728
+ var use_company_default = useCompany;
4729
+
4730
+ // src/hooks/core/use-app-provider.tsx
4731
+ var import_interface_logic10 = require("@fctc/interface-logic");
4732
+ var import_jsx_runtime = require("react/jsx-runtime");
4733
+ var AppProviderInitialValue = {
4734
+ config: {},
4735
+ user: {},
4736
+ auth: {},
4737
+ company: {},
4738
+ action: {},
4739
+ menu: {},
4740
+ view: {},
4741
+ list: {}
4742
+ };
4743
+ var ReactContext = (0, import_react10.createContext)(AppProviderInitialValue);
4744
+ var AppProvider = ({ children }) => {
4745
+ const config = useConfig({});
4746
+ const auth = useAuth();
4747
+ const user = useUser(auth.accessToken);
4748
+ const company = use_company_default(auth.accessToken);
4749
+ const menuContext = (0, import_react10.useMemo)(() => {
4750
+ return combineContexts([user.context, company.context]);
4751
+ }, [user.context, company.context]);
4752
+ const menu = useMenu({ context: menuContext });
4753
+ const action = (0, import_react10.useMemo)(() => {
4754
+ return menu.state.action;
4755
+ }, [menu.state.action]);
4756
+ const viewContext = (0, import_react10.useMemo)(() => {
4757
+ return combineContexts([
4758
+ menuContext,
4759
+ { ...(0, import_interface_logic10.evalJSONContext)(action?.result?.context) }
4760
+ ]);
4761
+ }, [menuContext, action?.result?.context]);
4762
+ const view = useViewV2({
4763
+ action,
4764
+ context: viewContext
4765
+ });
4766
+ const list = useListData({
4767
+ action,
4768
+ viewResponse: view.data,
4769
+ context: viewContext
4770
+ });
4771
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4772
+ ReactContext.Provider,
4773
+ {
4774
+ value: {
4775
+ config,
4776
+ auth,
4777
+ user,
4778
+ company,
4779
+ menu,
4780
+ list,
4781
+ action,
4782
+ view
4783
+ },
4784
+ children
4785
+ }
4786
+ );
4787
+ };
4788
+ var useAppProvider = () => {
4789
+ const context = (0, import_react10.useContext)(ReactContext);
4790
+ if (!context) {
4791
+ return AppProviderInitialValue;
4792
+ }
4793
+ return context;
4794
+ };
4795
+
4796
+ // src/hooks/utils/use-click-outside.ts
4797
+ var import_react11 = require("react");
4675
4798
  var DEFAULT_EVENTS = ["mousedown", "touchstart"];
4676
4799
  var useClickOutside = ({
4677
4800
  handler,
@@ -4679,8 +4802,8 @@ var useClickOutside = ({
4679
4802
  nodes = [],
4680
4803
  refs
4681
4804
  }) => {
4682
- const ref = (0, import_react9.useRef)(null);
4683
- (0, import_react9.useEffect)(() => {
4805
+ const ref = (0, import_react11.useRef)(null);
4806
+ (0, import_react11.useEffect)(() => {
4684
4807
  const listener = (event) => {
4685
4808
  const { target } = event;
4686
4809
  if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
@@ -4702,10 +4825,10 @@ var useClickOutside = ({
4702
4825
  };
4703
4826
 
4704
4827
  // src/hooks/utils/use-debounce.ts
4705
- var import_react10 = require("react");
4828
+ var import_react12 = require("react");
4706
4829
  function useDebounce(value, delay) {
4707
- const [debouncedValue, setDebouncedValue] = (0, import_react10.useState)(value);
4708
- (0, import_react10.useEffect)(() => {
4830
+ const [debouncedValue, setDebouncedValue] = (0, import_react12.useState)(value);
4831
+ (0, import_react12.useEffect)(() => {
4709
4832
  const handler = setTimeout(() => {
4710
4833
  setDebouncedValue(value);
4711
4834
  }, delay);
@@ -4716,9 +4839,132 @@ function useDebounce(value, delay) {
4716
4839
  return [debouncedValue];
4717
4840
  }
4718
4841
 
4842
+ // src/hooks/api/use-switch-locale.ts
4843
+ var import_interface_logic11 = require("@fctc/interface-logic");
4844
+ var import_react13 = require("react");
4845
+ var useSwitchLocaleHandler = () => {
4846
+ const switchUserLocale = (0, import_interface_logic11.useSwitchLocale)();
4847
+ const env = (0, import_interface_logic11.getEnv)();
4848
+ const { context } = (0, import_interface_logic11.useAppSelector)(import_interface_logic11.selectEnv);
4849
+ const switchLocale = (0, import_react13.useCallback)(
4850
+ async (langId) => {
4851
+ if (!langId) return;
4852
+ await switchUserLocale.mutateAsync({
4853
+ data: {
4854
+ id: parseInt(context?.uid),
4855
+ values: { lang: langId }
4856
+ }
4857
+ });
4858
+ env.setLang(langId);
4859
+ },
4860
+ [switchUserLocale]
4861
+ );
4862
+ return {
4863
+ switchLocale,
4864
+ isLoading: switchUserLocale.isPending,
4865
+ error: switchUserLocale.error
4866
+ };
4867
+ };
4868
+
4869
+ // src/hooks/api/use-login.ts
4870
+ var import_interface_logic12 = require("@fctc/interface-logic");
4871
+ var import_react14 = require("react");
4872
+ var useLoginHandler = () => {
4873
+ const loginMutate = (0, import_interface_logic12.useLoginCredential)();
4874
+ const login = (0, import_react14.useCallback)(
4875
+ ({
4876
+ email,
4877
+ password,
4878
+ path
4879
+ }, {
4880
+ onSuccess,
4881
+ onError
4882
+ }) => {
4883
+ loginMutate.mutate(
4884
+ {
4885
+ email,
4886
+ password,
4887
+ path
4888
+ },
4889
+ {
4890
+ onSuccess,
4891
+ onError
4892
+ }
4893
+ );
4894
+ },
4895
+ [loginMutate]
4896
+ );
4897
+ return {
4898
+ login,
4899
+ isLoading: loginMutate.isPending,
4900
+ error: loginMutate.error
4901
+ };
4902
+ };
4903
+
4904
+ // src/hooks/api/use-forgot-password.ts
4905
+ var import_interface_logic13 = require("@fctc/interface-logic");
4906
+ var import_react15 = require("react");
4907
+ var useForgotPasswordHandler = () => {
4908
+ const forgotPasswordMutate = (0, import_interface_logic13.useForgotPassword)();
4909
+ const sendForgotPassword = (0, import_react15.useCallback)(
4910
+ (email, {
4911
+ onSuccess,
4912
+ onError
4913
+ } = {}) => {
4914
+ forgotPasswordMutate.mutate(email, {
4915
+ onSuccess,
4916
+ onError
4917
+ });
4918
+ },
4919
+ [forgotPasswordMutate]
4920
+ );
4921
+ return {
4922
+ sendForgotPassword,
4923
+ isLoading: forgotPasswordMutate.isPending,
4924
+ error: forgotPasswordMutate.error
4925
+ };
4926
+ };
4927
+
4928
+ // src/hooks/api/use-reset-password.ts
4929
+ var import_interface_logic14 = require("@fctc/interface-logic");
4930
+ var import_react16 = require("react");
4931
+ var useResetPasswordHandler = () => {
4932
+ const resetPasswordMutate = (0, import_interface_logic14.useResetPassword)();
4933
+ const resetPassword = (0, import_react16.useCallback)(
4934
+ ({
4935
+ password,
4936
+ confirmPassword,
4937
+ token
4938
+ }, {
4939
+ onSuccess,
4940
+ onError
4941
+ }) => {
4942
+ resetPasswordMutate.mutate(
4943
+ {
4944
+ data: {
4945
+ password,
4946
+ confirmPassword
4947
+ },
4948
+ token
4949
+ },
4950
+ {
4951
+ onSuccess,
4952
+ onError
4953
+ }
4954
+ );
4955
+ },
4956
+ [resetPasswordMutate]
4957
+ );
4958
+ return {
4959
+ resetPassword,
4960
+ isLoading: resetPasswordMutate.isPending,
4961
+ error: resetPasswordMutate.error
4962
+ };
4963
+ };
4964
+
4719
4965
  // src/icons/eye-icon.tsx
4720
- var import_jsx_runtime = require("react/jsx-runtime");
4721
- var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4966
+ var import_jsx_runtime2 = require("react/jsx-runtime");
4967
+ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4722
4968
  "svg",
4723
4969
  {
4724
4970
  width: "20",
@@ -4727,7 +4973,7 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4727
4973
  fill: "none",
4728
4974
  xmlns: "http://www.w3.org/2000/svg",
4729
4975
  children: [
4730
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4976
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4731
4977
  "path",
4732
4978
  {
4733
4979
  d: "M2.72904 13.5776C2.02076 12.6574 1.66663 12.1974 1.66663 10.8312C1.66663 9.46507 2.02076 9.00499 2.72904 8.08483C4.14326 6.24752 6.51505 4.16455 9.99996 4.16455C13.4849 4.16455 15.8567 6.24752 17.2709 8.08483C17.9792 9.00499 18.3333 9.46507 18.3333 10.8312C18.3333 12.1974 17.9792 12.6574 17.2709 13.5776C15.8567 15.4149 13.4849 17.4979 9.99996 17.4979C6.51505 17.4979 4.14326 15.4149 2.72904 13.5776Z",
@@ -4735,7 +4981,7 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4735
4981
  strokeWidth: "1.5"
4736
4982
  }
4737
4983
  ),
4738
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4984
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4739
4985
  "path",
4740
4986
  {
4741
4987
  d: "M12.5 10.8311C12.5 12.2118 11.3807 13.3311 10 13.3311C8.61929 13.3311 7.5 12.2118 7.5 10.8311C7.5 9.45034 8.61929 8.33105 10 8.33105C11.3807 8.33105 12.5 9.45034 12.5 10.8311Z",
@@ -4748,13 +4994,13 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4748
4994
  );
4749
4995
 
4750
4996
  // src/icons/loading-icon.tsx
4751
- var import_jsx_runtime2 = require("react/jsx-runtime");
4997
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4752
4998
  var LoadingIcon = ({
4753
4999
  width = 15,
4754
5000
  height = 15,
4755
5001
  ...props
4756
5002
  }) => {
4757
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5003
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4758
5004
  "svg",
4759
5005
  {
4760
5006
  xmlns: "http://www.w3.org/2000/svg",
@@ -4769,8 +5015,8 @@ var LoadingIcon = ({
4769
5015
  background: "transparent"
4770
5016
  },
4771
5017
  ...props,
4772
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { children: [
4773
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5018
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
5019
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4774
5020
  "circle",
4775
5021
  {
4776
5022
  strokeDasharray: "141.37166941154067 49.12388980384689",
@@ -4780,7 +5026,7 @@ var LoadingIcon = ({
4780
5026
  fill: "none",
4781
5027
  cy: "50",
4782
5028
  cx: "50",
4783
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5029
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4784
5030
  "animateTransform",
4785
5031
  {
4786
5032
  keyTimes: "0;1",
@@ -4793,16 +5039,16 @@ var LoadingIcon = ({
4793
5039
  )
4794
5040
  }
4795
5041
  ),
4796
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", {})
5042
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", {})
4797
5043
  ] })
4798
5044
  }
4799
5045
  );
4800
5046
  };
4801
5047
 
4802
5048
  // src/icons/close-icon.tsx
4803
- var import_jsx_runtime3 = require("react/jsx-runtime");
5049
+ var import_jsx_runtime4 = require("react/jsx-runtime");
4804
5050
  var CloseIcon = ({ className = "" }) => {
4805
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5051
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4806
5052
  "svg",
4807
5053
  {
4808
5054
  width: "24",
@@ -4811,7 +5057,7 @@ var CloseIcon = ({ className = "" }) => {
4811
5057
  fill: "none",
4812
5058
  xmlns: "http://www.w3.org/2000/svg",
4813
5059
  className,
4814
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5060
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4815
5061
  "path",
4816
5062
  {
4817
5063
  d: "M12.0001 10.7275L16.4551 6.27246L17.7277 7.54506L13.2727 12.0001L17.7277 16.4551L16.4551 17.7277L12.0001 13.2727L7.54506 17.7277L6.27246 16.4551L10.7275 12.0001L6.27246 7.54506L7.54506 6.27246L12.0001 10.7275Z",
@@ -4823,19 +5069,19 @@ var CloseIcon = ({ className = "" }) => {
4823
5069
  };
4824
5070
 
4825
5071
  // src/widget/basic/status-dropdown-field/controller.ts
4826
- var import_react11 = require("react");
4827
- var import_interface_logic9 = require("@fctc/interface-logic");
5072
+ var import_react17 = require("react");
5073
+ var import_interface_logic15 = require("@fctc/interface-logic");
4828
5074
  var statusDropdownController = (props) => {
4829
5075
  const { selection, isForm, id, model, name, state, onRefetch } = props;
4830
- const env = (0, import_interface_logic9.getEnv)();
5076
+ const env = (0, import_interface_logic15.getEnv)();
4831
5077
  const colors = {
4832
5078
  normal: "bg-[#e9ecef]",
4833
5079
  done: "bg-primary",
4834
5080
  blocked: "bg-red-500"
4835
5081
  };
4836
- const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
4837
- const buttonRef = (0, import_react11.useRef)(null);
4838
- (0, import_react11.useEffect)(() => {
5082
+ const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
5083
+ const buttonRef = (0, import_react17.useRef)(null);
5084
+ (0, import_react17.useEffect)(() => {
4839
5085
  const handleClickOutside = (event) => {
4840
5086
  if (buttonRef.current && !buttonRef.current.contains(event.target)) {
4841
5087
  setIsOpen(false);
@@ -4846,7 +5092,7 @@ var statusDropdownController = (props) => {
4846
5092
  document.removeEventListener("mousedown", handleClickOutside);
4847
5093
  };
4848
5094
  }, []);
4849
- const { mutate: onSave } = (0, import_interface_logic9.useSave)();
5095
+ const { mutate: onSave } = (0, import_interface_logic15.useSave)();
4850
5096
  const handleClick = async (status) => {
4851
5097
  setIsOpen(!isOpen);
4852
5098
  onSave(
@@ -4876,8 +5122,8 @@ var statusDropdownController = (props) => {
4876
5122
  };
4877
5123
 
4878
5124
  // src/widget/basic/many2one-field/controller.ts
4879
- var import_react12 = require("react");
4880
- var import_interface_logic10 = require("@fctc/interface-logic");
5125
+ var import_react18 = require("react");
5126
+ var import_interface_logic16 = require("@fctc/interface-logic");
4881
5127
  var many2oneFieldController = (props) => {
4882
5128
  const {
4883
5129
  name,
@@ -4892,24 +5138,24 @@ var many2oneFieldController = (props) => {
4892
5138
  showDetail = true,
4893
5139
  actionData
4894
5140
  } = props;
4895
- const [options, setOptions] = (0, import_react12.useState)([]);
4896
- const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react12.useState)(false);
4897
- const [tempSelectedOption, setTempSelectedOption] = (0, import_react12.useState)(null);
4898
- const { menuList } = (0, import_interface_logic10.useAppSelector)(import_interface_logic10.selectNavbar);
4899
- const { context } = (0, import_interface_logic10.useAppSelector)(import_interface_logic10.selectEnv);
4900
- const [domainModal, setDomainModal] = (0, import_react12.useState)(null);
5141
+ const [options, setOptions] = (0, import_react18.useState)([]);
5142
+ const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react18.useState)(false);
5143
+ const [tempSelectedOption, setTempSelectedOption] = (0, import_react18.useState)(null);
5144
+ const { menuList } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectNavbar);
5145
+ const { context } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectEnv);
5146
+ const [domainModal, setDomainModal] = (0, import_react18.useState)(null);
4901
5147
  const initValue = methods?.getValues(name);
4902
- const domainObject = (0, import_react12.useMemo)(
4903
- () => (0, import_interface_logic10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
5148
+ const domainObject = (0, import_react18.useMemo)(
5149
+ () => (0, import_interface_logic16.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
4904
5150
  [domain, formValues]
4905
5151
  );
4906
- const optionsObject = (0, import_interface_logic10.evalJSONContext)(fieldOptions) || {};
5152
+ const optionsObject = (0, import_interface_logic16.evalJSONContext)(fieldOptions) || {};
4907
5153
  const contextObject = {
4908
- ...(0, import_interface_logic10.evalJSONContext)(actionData?.context) || {},
5154
+ ...(0, import_interface_logic16.evalJSONContext)(actionData?.context) || {},
4909
5155
  ...fieldContext,
4910
5156
  ...context
4911
5157
  };
4912
- const actionId = (0, import_react12.useMemo)(
5158
+ const actionId = (0, import_react18.useMemo)(
4913
5159
  () => menuList?.flatMap(
4914
5160
  (item) => item?.child_id.filter(
4915
5161
  (childItem) => childItem?.is_display && childItem?.action?.res_model === relation
@@ -4930,25 +5176,25 @@ var many2oneFieldController = (props) => {
4930
5176
  const queryKey = [`data_${relation}`, domainObject];
4931
5177
  const {
4932
5178
  data: dataOfSelection,
4933
- // refetch,
5179
+ refetch,
4934
5180
  isFetching
4935
- } = (0, import_interface_logic10.useGetSelection)({
5181
+ } = (0, import_interface_logic16.useGetSelection)({
4936
5182
  data,
4937
5183
  queryKey,
4938
5184
  enabled: false
4939
5185
  });
4940
- const selectOptions = (0, import_react12.useMemo)(() => {
5186
+ const selectOptions = (0, import_react18.useMemo)(() => {
4941
5187
  return dataOfSelection?.records?.map((val) => ({
4942
5188
  value: val?.id,
4943
5189
  label: val?.display_name || val?.name
4944
5190
  })) || [];
4945
5191
  }, [dataOfSelection]);
4946
- (0, import_react12.useEffect)(() => {
5192
+ (0, import_react18.useEffect)(() => {
4947
5193
  setOptions(selectOptions);
4948
5194
  setDomainModal(domainObject);
4949
- if (relation === "student.subject") (0, import_interface_logic10.setListSubject)(selectOptions);
5195
+ if (relation === "student.subject") (0, import_interface_logic16.setListSubject)(selectOptions);
4950
5196
  }, [selectOptions]);
4951
- (0, import_react12.useEffect)(() => {
5197
+ (0, import_react18.useEffect)(() => {
4952
5198
  if (!propValue && tempSelectedOption) {
4953
5199
  methods.setValue(name, null);
4954
5200
  setTempSelectedOption(null);
@@ -4959,12 +5205,15 @@ var many2oneFieldController = (props) => {
4959
5205
  });
4960
5206
  }
4961
5207
  }, [propValue]);
4962
- (0, import_react12.useEffect)(() => {
5208
+ const fetchMoreOptions = (0, import_react18.useCallback)(() => {
5209
+ refetch();
5210
+ }, [refetch]);
5211
+ (0, import_react18.useEffect)(() => {
4963
5212
  if (actionId) {
4964
5213
  localStorage.setItem("aid", actionId);
4965
5214
  }
4966
5215
  }, [actionId]);
4967
- const handleChooseRecord = (0, import_react12.useCallback)(
5216
+ const handleChooseRecord = (0, import_react18.useCallback)(
4968
5217
  (idRecord) => {
4969
5218
  const newOption = options.find(
4970
5219
  (option) => option.value === idRecord
@@ -4989,8 +5238,8 @@ var many2oneFieldController = (props) => {
4989
5238
  },
4990
5239
  [options, methods, name, onChange]
4991
5240
  );
4992
- const handleClose = (0, import_react12.useCallback)(() => setIsShowModalMany2Many(false), []);
4993
- const handleSelectChange = (0, import_react12.useCallback)(
5241
+ const handleClose = (0, import_react18.useCallback)(() => setIsShowModalMany2Many(false), []);
5242
+ const handleSelectChange = (0, import_react18.useCallback)(
4994
5243
  (selectedOption) => {
4995
5244
  if (!selectedOption) {
4996
5245
  methods.setValue(name, null, { shouldDirty: true });
@@ -5024,13 +5273,13 @@ var many2oneFieldController = (props) => {
5024
5273
  isFetching,
5025
5274
  isShowModalMany2Many,
5026
5275
  options,
5027
- // fetchMoreOptions,
5276
+ fetchMoreOptions,
5028
5277
  domainModal,
5029
5278
  tempSelectedOption,
5030
5279
  setTempSelectedOption,
5031
5280
  setDomainModal,
5032
5281
  dataOfSelection,
5033
- // refetch,
5282
+ refetch,
5034
5283
  selectOptions,
5035
5284
  optionsObject,
5036
5285
  contextObject,
@@ -5040,18 +5289,18 @@ var many2oneFieldController = (props) => {
5040
5289
  };
5041
5290
 
5042
5291
  // src/widget/basic/many2one-button-field/controller.ts
5043
- var import_interface_logic11 = require("@fctc/interface-logic");
5292
+ var import_interface_logic17 = require("@fctc/interface-logic");
5044
5293
  var many2oneButtonController = (props) => {
5045
5294
  const { domain, methods, relation } = props;
5046
5295
  const actionDataString = sessionStorage.getItem("actionData");
5047
- const env = (0, import_interface_logic11.getEnv)();
5048
- const domainObject = (0, import_interface_logic11.evalJSONDomain)(domain, methods?.getValues() || {});
5296
+ const env = (0, import_interface_logic17.getEnv)();
5297
+ const domainObject = (0, import_interface_logic17.evalJSONDomain)(domain, methods?.getValues() || {});
5049
5298
  const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
5050
- const { data: dataOfSelection } = (0, import_interface_logic11.useGetSelection)({
5299
+ const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
5051
5300
  data: {
5052
5301
  model: relation ?? "",
5053
5302
  domain: domainObject,
5054
- context: { ...env.context, ...(0, import_interface_logic11.evalJSONContext)(actionData?.context) }
5303
+ context: { ...env.context, ...(0, import_interface_logic17.evalJSONContext)(actionData?.context) }
5055
5304
  },
5056
5305
  queryKey: [`data_${relation}`, domainObject]
5057
5306
  });
@@ -5065,22 +5314,15 @@ var many2oneButtonController = (props) => {
5065
5314
  };
5066
5315
 
5067
5316
  // src/widget/basic/many2many-field/controller.ts
5068
- var import_react16 = require("react");
5069
- var import_interface_logic16 = require("@fctc/interface-logic");
5070
-
5071
- // src/widget/advance/table/table-body/controller.ts
5072
- var import_interface_logic12 = require("@fctc/interface-logic");
5073
- var import_react13 = require("react");
5074
-
5075
- // src/widget/advance/table/table-head/controller.ts
5076
- var import_interface_logic13 = require("@fctc/interface-logic");
5317
+ var import_react20 = require("react");
5318
+ var import_interface_logic19 = require("@fctc/interface-logic");
5077
5319
 
5078
5320
  // src/widget/advance/table/table-view/controller.ts
5079
- var import_interface_logic14 = require("@fctc/interface-logic");
5080
- var import_react14 = require("react");
5321
+ var import_interface_logic18 = require("@fctc/interface-logic");
5322
+ var import_react19 = require("react");
5081
5323
  var tableController = ({ data }) => {
5082
- const [rows, setRows] = (0, import_react14.useState)(data.records || []);
5083
- const [columns, setColumns] = (0, import_react14.useState)([]);
5324
+ const [rows, setRows] = (0, import_react19.useState)(data.records || []);
5325
+ const [columns, setColumns] = (0, import_react19.useState)([]);
5084
5326
  const dataModelFields = data.fields?.map((field) => {
5085
5327
  return {
5086
5328
  ...data.dataModel?.[field?.name],
@@ -5108,14 +5350,14 @@ var tableController = ({ data }) => {
5108
5350
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
5109
5351
  });
5110
5352
  };
5111
- (0, import_react14.useEffect)(() => {
5353
+ (0, import_react19.useEffect)(() => {
5112
5354
  setRows(transformData(data.records || null));
5113
5355
  }, [data.records]);
5114
5356
  const handleGetColumns = () => {
5115
5357
  let cols = [];
5116
5358
  try {
5117
5359
  cols = mergeFields?.filter((item) => {
5118
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.invisible) : false);
5360
+ return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.invisible) : false);
5119
5361
  })?.map((field) => {
5120
5362
  return {
5121
5363
  name: field?.name,
@@ -5129,7 +5371,7 @@ var tableController = ({ data }) => {
5129
5371
  }
5130
5372
  return cols;
5131
5373
  };
5132
- (0, import_react14.useEffect)(() => {
5374
+ (0, import_react19.useEffect)(() => {
5133
5375
  const columns2 = handleGetColumns();
5134
5376
  setColumns(columns2);
5135
5377
  }, [data.records]);
@@ -5153,32 +5395,6 @@ var tableController = ({ data }) => {
5153
5395
  };
5154
5396
  };
5155
5397
 
5156
- // src/widget/advance/table/table-group/controller.ts
5157
- var import_interface_logic15 = require("@fctc/interface-logic");
5158
- var import_react15 = require("react");
5159
-
5160
- // src/utils/i18n.ts
5161
- var import_react_i18next2 = require("react-i18next");
5162
- var import_i18next = __toESM(require("i18next"));
5163
- var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5164
- import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
5165
- resources: {
5166
- vi: { translation: vi },
5167
- en: { translation: en }
5168
- },
5169
- fallbackLng: "vi",
5170
- lng: "vi_VN",
5171
- debug: false,
5172
- nonExplicitSupportedLngs: true,
5173
- interpolation: {
5174
- escapeValue: false
5175
- },
5176
- detection: {
5177
- caches: ["cookie"]
5178
- }
5179
- });
5180
- var i18n_default = import_i18next.default;
5181
-
5182
5398
  // src/widget/basic/many2many-field/controller.ts
5183
5399
  var many2manyFieldController = (props) => {
5184
5400
  const {
@@ -5188,7 +5404,7 @@ var many2manyFieldController = (props) => {
5188
5404
  tab,
5189
5405
  model,
5190
5406
  aid,
5191
- setSelectedRowKeys: setSelectedRowKeys4,
5407
+ setSelectedRowKeys,
5192
5408
  fields,
5193
5409
  setFields,
5194
5410
  groupByDomain,
@@ -5196,14 +5412,14 @@ var many2manyFieldController = (props) => {
5196
5412
  options,
5197
5413
  sessionStorageUtils
5198
5414
  } = props;
5199
- const appDispatch = (0, import_interface_logic16.useAppDispatch)();
5415
+ const appDispatch = (0, import_interface_logic19.useAppDispatch)();
5200
5416
  const actionData = sessionStorageUtils.getActionData();
5201
5417
  const [debouncedPage] = useDebounce(page, 500);
5202
- const [order, setOrder] = (0, import_react16.useState)();
5203
- const [isLoadedData, setIsLoadedData] = (0, import_react16.useState)(false);
5204
- const [domainMany2Many, setDomainMany2Many] = (0, import_react16.useState)(domain);
5205
- const env = (0, import_interface_logic16.getEnv)();
5206
- const { selectedTags } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectSearch);
5418
+ const [order, setOrder] = (0, import_react20.useState)();
5419
+ const [isLoadedData, setIsLoadedData] = (0, import_react20.useState)(false);
5420
+ const [domainMany2Many, setDomainMany2Many] = (0, import_react20.useState)(domain);
5421
+ const env = (0, import_interface_logic19.getEnv)();
5422
+ const { selectedTags } = (0, import_interface_logic19.useAppSelector)(import_interface_logic19.selectSearch);
5207
5423
  const viewParams = {
5208
5424
  model: relation,
5209
5425
  views: [
@@ -5212,11 +5428,11 @@ var many2manyFieldController = (props) => {
5212
5428
  ],
5213
5429
  context
5214
5430
  };
5215
- const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic16.useGetView)(
5431
+ const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic19.useGetView)(
5216
5432
  viewParams,
5217
5433
  actionData
5218
5434
  );
5219
- const baseModel = (0, import_react16.useMemo)(
5435
+ const baseModel = (0, import_react20.useMemo)(
5220
5436
  () => ({
5221
5437
  name: String(relation),
5222
5438
  view: viewResponse || {},
@@ -5228,26 +5444,26 @@ var many2manyFieldController = (props) => {
5228
5444
  }),
5229
5445
  [model, viewResponse]
5230
5446
  );
5231
- const initModel = (0, import_interface_logic16.useModel)();
5232
- const modelInstance = (0, import_react16.useMemo)(() => {
5447
+ const initModel = (0, import_interface_logic19.useModel)();
5448
+ const modelInstance = (0, import_react20.useMemo)(() => {
5233
5449
  if (viewResponse) {
5234
5450
  return initModel.initModel(baseModel);
5235
5451
  }
5236
5452
  return null;
5237
5453
  }, [baseModel, viewResponse]);
5238
- const specification = (0, import_react16.useMemo)(() => {
5454
+ const specification = (0, import_react20.useMemo)(() => {
5239
5455
  if (modelInstance) {
5240
5456
  return modelInstance.getSpecification();
5241
5457
  }
5242
5458
  return null;
5243
5459
  }, [modelInstance]);
5244
5460
  const default_order = viewResponse && viewResponse?.views?.list?.default_order;
5245
- const optionsObject = tab?.options ? (0, import_interface_logic16.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic16.evalJSONContext)(options) : {}) || {};
5461
+ const optionsObject = tab?.options ? (0, import_interface_logic19.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic19.evalJSONContext)(options) : {}) || {};
5246
5462
  const fetchData = async () => {
5247
5463
  try {
5248
5464
  setDomainMany2Many(domain);
5249
- appDispatch((0, import_interface_logic16.setFirstDomain)(domain));
5250
- appDispatch((0, import_interface_logic16.setViewDataStore)(viewResponse));
5465
+ appDispatch((0, import_interface_logic19.setFirstDomain)(domain));
5466
+ appDispatch((0, import_interface_logic19.setViewDataStore)(viewResponse));
5251
5467
  const modalData = viewResponse?.views?.list?.fields.map((field) => ({
5252
5468
  ...viewResponse?.models?.[String(model)]?.[field?.name],
5253
5469
  ...field
@@ -5258,7 +5474,7 @@ var many2manyFieldController = (props) => {
5258
5474
  [`${aid}_${relation}_popupmany2many`]: modalData
5259
5475
  });
5260
5476
  }
5261
- appDispatch((0, import_interface_logic16.setPage)(0));
5477
+ appDispatch((0, import_interface_logic19.setPage)(0));
5262
5478
  } catch (err) {
5263
5479
  console.log(err);
5264
5480
  }
@@ -5280,7 +5496,7 @@ var many2manyFieldController = (props) => {
5280
5496
  context,
5281
5497
  fields: groupByDomain?.fields,
5282
5498
  groupby: [groupByDomain?.contexts[0]?.group_by],
5283
- sort: order ? order : default_order ? (0, import_interface_logic16.formatSortingString)(default_order) : ""
5499
+ sort: order ? order : default_order ? (0, import_interface_logic19.formatSortingString)(default_order) : ""
5284
5500
  };
5285
5501
  const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
5286
5502
  const {
@@ -5288,19 +5504,19 @@ var many2manyFieldController = (props) => {
5288
5504
  isLoading: isDataLoading,
5289
5505
  isFetched: isDataResponseFetched,
5290
5506
  isPlaceholderData
5291
- } = (0, import_interface_logic16.useGetListData)(data, queryKey, enabled);
5292
- (0, import_react16.useEffect)(() => {
5507
+ } = (0, import_interface_logic19.useGetListData)(data, queryKey, enabled);
5508
+ (0, import_react20.useEffect)(() => {
5293
5509
  if (viewResponse) {
5294
5510
  fetchData();
5295
5511
  }
5296
5512
  return () => {
5297
- appDispatch((0, import_interface_logic16.setGroupByDomain)(null));
5513
+ appDispatch((0, import_interface_logic19.setGroupByDomain)(null));
5298
5514
  setFields((prevFields) => ({
5299
5515
  ...prevFields,
5300
5516
  [`${aid}_${relation}_popupmany2many`]: null
5301
5517
  }));
5302
- appDispatch((0, import_interface_logic16.setPage)(0));
5303
- setSelectedRowKeys4([]);
5518
+ appDispatch((0, import_interface_logic19.setPage)(0));
5519
+ setSelectedRowKeys([]);
5304
5520
  setDomainMany2Many(null);
5305
5521
  setIsLoadedData(false);
5306
5522
  };
@@ -5323,18 +5539,18 @@ var many2manyFieldController = (props) => {
5323
5539
  refetch,
5324
5540
  data: dataFormViewResponse,
5325
5541
  isSuccess
5326
- } = (0, import_interface_logic16.useGetFormView)({
5542
+ } = (0, import_interface_logic19.useGetFormView)({
5327
5543
  data: dataFormView,
5328
5544
  queryKey: [`form-view-action-${relation}`],
5329
5545
  enabled: false
5330
5546
  });
5331
- (0, import_react16.useEffect)(() => {
5547
+ (0, import_react20.useEffect)(() => {
5332
5548
  if (isSuccess && dataFormViewResponse) {
5333
5549
  sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
5334
5550
  window.location.href = `/form/menu?model=${relation}`;
5335
5551
  }
5336
5552
  }, [isSuccess]);
5337
- (0, import_react16.useEffect)(() => {
5553
+ (0, import_react20.useEffect)(() => {
5338
5554
  if (domainMany2Many && !isLoadedData) {
5339
5555
  setIsLoadedData(true);
5340
5556
  }
@@ -5350,8 +5566,8 @@ var many2manyFieldController = (props) => {
5350
5566
  };
5351
5567
 
5352
5568
  // src/widget/basic/many2many-tags-field/controller.ts
5353
- var import_react17 = require("react");
5354
- var import_interface_logic17 = require("@fctc/interface-logic");
5569
+ var import_react21 = require("react");
5570
+ var import_interface_logic20 = require("@fctc/interface-logic");
5355
5571
  var many2manyTagsController = (props) => {
5356
5572
  const {
5357
5573
  relation,
@@ -5362,10 +5578,10 @@ var many2manyTagsController = (props) => {
5362
5578
  placeholderNoOption
5363
5579
  } = props;
5364
5580
  const isUser = relation === "res.users" || relation === "res.partner";
5365
- const env = (0, import_interface_logic17.getEnv)();
5366
- const addtionalFields = optionsFields ? (0, import_interface_logic17.evalJSONContext)(optionsFields) : null;
5367
- const domainObject = (0, import_react17.useMemo)(
5368
- () => (0, import_interface_logic17.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5581
+ const env = (0, import_interface_logic20.getEnv)();
5582
+ const addtionalFields = optionsFields ? (0, import_interface_logic20.evalJSONContext)(optionsFields) : null;
5583
+ const domainObject = (0, import_react21.useMemo)(
5584
+ () => (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5369
5585
  [domain, formValues]
5370
5586
  );
5371
5587
  const data = {
@@ -5375,13 +5591,13 @@ var many2manyTagsController = (props) => {
5375
5591
  id: {},
5376
5592
  name: {},
5377
5593
  display_name: {},
5378
- ...widget && import_interface_logic17.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5379
- ...widget && import_interface_logic17.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5594
+ ...widget && import_interface_logic20.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5595
+ ...widget && import_interface_logic20.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5380
5596
  },
5381
5597
  enabled: true,
5382
5598
  context: env.context
5383
5599
  };
5384
- const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
5600
+ const { data: dataOfSelection } = (0, import_interface_logic20.useGetSelection)({
5385
5601
  data,
5386
5602
  queryKey: [`data_${relation}`, domainObject]
5387
5603
  });
@@ -5407,8 +5623,8 @@ var many2manyTagsController = (props) => {
5407
5623
  };
5408
5624
 
5409
5625
  // src/widget/basic/status-bar-field/controller.ts
5410
- var import_react18 = require("react");
5411
- var import_interface_logic18 = require("@fctc/interface-logic");
5626
+ var import_react22 = require("react");
5627
+ var import_interface_logic21 = require("@fctc/interface-logic");
5412
5628
  var durationController = (props) => {
5413
5629
  const {
5414
5630
  relation,
@@ -5425,14 +5641,14 @@ var durationController = (props) => {
5425
5641
  name: "",
5426
5642
  fold: ""
5427
5643
  };
5428
- const [disabled, setDisabled] = (0, import_react18.useState)(false);
5429
- const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
5430
- const { context } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectEnv);
5644
+ const [disabled, setDisabled] = (0, import_react22.useState)(false);
5645
+ const [modelStatus, setModalStatus] = (0, import_react22.useState)(false);
5646
+ const { context } = (0, import_interface_logic21.useAppSelector)(import_interface_logic21.selectEnv);
5431
5647
  const queryKey = [`data-status-duration`, specification];
5432
5648
  const listDataProps = {
5433
5649
  model: relation,
5434
5650
  specification,
5435
- domain: (0, import_interface_logic18.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5651
+ domain: (0, import_interface_logic21.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5436
5652
  limit: 10,
5437
5653
  offset: 0,
5438
5654
  fields: "",
@@ -5442,8 +5658,8 @@ var durationController = (props) => {
5442
5658
  },
5443
5659
  sort: ""
5444
5660
  };
5445
- const { data: dataResponse } = (0, import_interface_logic18.useGetListData)(listDataProps, queryKey);
5446
- const { mutate: fetchChangeStatus } = (0, import_interface_logic18.useChangeStatus)();
5661
+ const { data: dataResponse } = (0, import_interface_logic21.useGetListData)(listDataProps, queryKey);
5662
+ const { mutate: fetchChangeStatus } = (0, import_interface_logic21.useChangeStatus)();
5447
5663
  const handleClick = async (stage_id) => {
5448
5664
  setDisabled(true);
5449
5665
  if (stage_id) {
@@ -5479,7 +5695,7 @@ var durationController = (props) => {
5479
5695
  };
5480
5696
 
5481
5697
  // src/widget/basic/priority-field/controller.ts
5482
- var import_interface_logic19 = require("@fctc/interface-logic");
5698
+ var import_interface_logic22 = require("@fctc/interface-logic");
5483
5699
  var priorityFieldController = (props) => {
5484
5700
  const {
5485
5701
  value,
@@ -5494,11 +5710,11 @@ var priorityFieldController = (props) => {
5494
5710
  viewData,
5495
5711
  context
5496
5712
  } = props;
5497
- const _context = { ...(0, import_interface_logic19.evalJSONContext)(actionData?.context) };
5713
+ const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) };
5498
5714
  const contextObject = { ...context, ..._context };
5499
5715
  const defaultPriority = parseInt(value) + 1;
5500
5716
  const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
5501
- const { mutateAsync: fetchSave } = (0, import_interface_logic19.useSave)();
5717
+ const { mutateAsync: fetchSave } = (0, import_interface_logic22.useSave)();
5502
5718
  const savePriorities = async ({
5503
5719
  value: value2,
5504
5720
  resetPriority
@@ -5533,8 +5749,8 @@ var priorityFieldController = (props) => {
5533
5749
  };
5534
5750
 
5535
5751
  // src/widget/basic/float-time-field/controller.ts
5536
- var import_react19 = require("react");
5537
- var import_interface_logic20 = require("@fctc/interface-logic");
5752
+ var import_react23 = require("react");
5753
+ var import_interface_logic23 = require("@fctc/interface-logic");
5538
5754
  var floatTimeFiledController = ({
5539
5755
  onChange: fieldOnChange,
5540
5756
  onBlur,
@@ -5543,11 +5759,11 @@ var floatTimeFiledController = ({
5543
5759
  props
5544
5760
  }) => {
5545
5761
  const { name, defaultValue = 0, onChange } = props;
5546
- const [input, setInput] = (0, import_react19.useState)(
5547
- (0, import_interface_logic20.convertFloatToTime)(value ?? defaultValue)
5762
+ const [input, setInput] = (0, import_react23.useState)(
5763
+ (0, import_interface_logic23.convertFloatToTime)(value ?? defaultValue)
5548
5764
  );
5549
- const [formattedTime, setFormattedTime] = (0, import_react19.useState)("");
5550
- const [errors, setErrors] = (0, import_react19.useState)("");
5765
+ const [formattedTime, setFormattedTime] = (0, import_react23.useState)("");
5766
+ const [errors, setErrors] = (0, import_react23.useState)("");
5551
5767
  const handleInputChange = (e) => {
5552
5768
  const raw = e.target.value.replace(/[^\d:]/g, "");
5553
5769
  setInput(raw);
@@ -5577,7 +5793,7 @@ var floatTimeFiledController = ({
5577
5793
  if (!isDirty) return;
5578
5794
  if (formattedTime) {
5579
5795
  setInput(formattedTime);
5580
- const floatVal = (0, import_interface_logic20.convertTimeToFloat)(formattedTime);
5796
+ const floatVal = (0, import_interface_logic23.convertTimeToFloat)(formattedTime);
5581
5797
  fieldOnChange(floatVal);
5582
5798
  if (onChange) {
5583
5799
  onChange(name ?? "", floatVal);
@@ -5620,7 +5836,31 @@ var floatTimeFiledController = ({
5620
5836
  };
5621
5837
 
5622
5838
  // src/widget/basic/float-field/controller.ts
5623
- var import_react20 = require("react");
5839
+ var import_react24 = require("react");
5840
+
5841
+ // src/utils/i18n.ts
5842
+ var import_react_i18next2 = require("react-i18next");
5843
+ var import_i18next = __toESM(require("i18next"));
5844
+ var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5845
+ import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
5846
+ resources: {
5847
+ vi: { translation: vi },
5848
+ en: { translation: en }
5849
+ },
5850
+ fallbackLng: "vi",
5851
+ lng: "vi_VN",
5852
+ debug: false,
5853
+ nonExplicitSupportedLngs: true,
5854
+ interpolation: {
5855
+ escapeValue: false
5856
+ },
5857
+ detection: {
5858
+ caches: ["cookie"]
5859
+ }
5860
+ });
5861
+ var i18n_default = import_i18next.default;
5862
+
5863
+ // src/widget/basic/float-field/controller.ts
5624
5864
  var floatController = ({
5625
5865
  onChange,
5626
5866
  value,
@@ -5628,10 +5868,10 @@ var floatController = ({
5628
5868
  }) => {
5629
5869
  const { name, required, methods, onChange: handleOnchange, string } = props;
5630
5870
  const { setError, clearErrors } = methods;
5631
- const [inputValue, setInputValue] = (0, import_react20.useState)(
5871
+ const [inputValue, setInputValue] = (0, import_react24.useState)(
5632
5872
  value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
5633
5873
  );
5634
- (0, import_react20.useEffect)(() => {
5874
+ (0, import_react24.useEffect)(() => {
5635
5875
  if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
5636
5876
  setInputValue(useFormatFloatNumber(value));
5637
5877
  clearErrors(name);
@@ -5639,9 +5879,9 @@ var floatController = ({
5639
5879
  setInputValue("");
5640
5880
  }
5641
5881
  }, [value, name, clearErrors]);
5642
- const isDirtyRef = (0, import_react20.useRef)(false);
5643
- const inputRef = (0, import_react20.useRef)(null);
5644
- const lastCommittedValueRef = (0, import_react20.useRef)(null);
5882
+ const isDirtyRef = (0, import_react24.useRef)(false);
5883
+ const inputRef = (0, import_react24.useRef)(null);
5884
+ const lastCommittedValueRef = (0, import_react24.useRef)(null);
5645
5885
  const handleInputChange = (e) => {
5646
5886
  const newValue = e.target.value;
5647
5887
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -5742,10 +5982,10 @@ var useFormatFloatNumber = (value) => {
5742
5982
  };
5743
5983
 
5744
5984
  // src/widget/basic/download-file-field/controller.ts
5745
- var import_react21 = require("react");
5985
+ var import_react25 = require("react");
5746
5986
  var downloadFileController = () => {
5747
- const inputId = (0, import_react21.useId)();
5748
- const [file, setFile] = (0, import_react21.useState)(null);
5987
+ const inputId = (0, import_react25.useId)();
5988
+ const [file, setFile] = (0, import_react25.useState)(null);
5749
5989
  const handleFileChange = (e) => {
5750
5990
  setFile(e.target.files[0]);
5751
5991
  };
@@ -5797,9 +6037,6 @@ var downLoadBinaryController = (props) => {
5797
6037
  };
5798
6038
 
5799
6039
  // src/widget/basic/date-field/controller.ts
5800
- var import_day = __toESM(require("react-datepicker/dist/day"));
5801
- var import_month = __toESM(require("react-datepicker/dist/month"));
5802
- var import_year = __toESM(require("react-datepicker/dist/year"));
5803
6040
  var import_moment = __toESM(require_moment());
5804
6041
  var DURATIONS = {
5805
6042
  PAST: "past",
@@ -5907,21 +6144,18 @@ var dateFieldController = (props) => {
5907
6144
  months_en,
5908
6145
  customValidateMinMax,
5909
6146
  minNowValue,
5910
- maxNowValue,
5911
- year: import_year.default,
5912
- month: import_month.default,
5913
- day: import_day.default
6147
+ maxNowValue
5914
6148
  };
5915
6149
  };
5916
6150
 
5917
6151
  // src/widget/basic/copy-link-button/controller.ts
5918
- var import_react22 = require("react");
5919
- var import_interface_logic21 = require("@fctc/interface-logic");
6152
+ var import_react26 = require("react");
6153
+ var import_interface_logic24 = require("@fctc/interface-logic");
5920
6154
  var copyLinkButtonController = (props) => {
5921
6155
  const { value, defaultValue } = props;
5922
- const [isCopied, setIsCopied] = (0, import_react22.useState)(false);
6156
+ const [isCopied, setIsCopied] = (0, import_react26.useState)(false);
5923
6157
  const handleCopyToClipboard = async (value2) => {
5924
- await (0, import_interface_logic21.copyTextToClipboard)(value2);
6158
+ await (0, import_interface_logic24.copyTextToClipboard)(value2);
5925
6159
  setIsCopied(true);
5926
6160
  setTimeout(() => setIsCopied(false), 2e3);
5927
6161
  };
@@ -5934,14 +6168,14 @@ var copyLinkButtonController = (props) => {
5934
6168
  };
5935
6169
 
5936
6170
  // src/widget/basic/color-field/color-controller.ts
5937
- var import_interface_logic22 = require("@fctc/interface-logic");
6171
+ var import_interface_logic25 = require("@fctc/interface-logic");
5938
6172
  var colorFieldController = (props) => {
5939
6173
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
5940
- const env = (0, import_interface_logic22.getEnv)();
5941
- const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) || {} };
6174
+ const env = (0, import_interface_logic25.getEnv)();
6175
+ const _context = { ...(0, import_interface_logic25.evalJSONContext)(actionData?.context) || {} };
5942
6176
  const contextObject = { ...env.context, ..._context };
5943
6177
  const idDefault = isForm ? idForm : formValues?.id;
5944
- const { mutate: onSave } = (0, import_interface_logic22.useSave)();
6178
+ const { mutate: onSave } = (0, import_interface_logic25.useSave)();
5945
6179
  const savePickColor = async (colorObject) => {
5946
6180
  const { id } = colorObject;
5947
6181
  if (value === id) return;
@@ -5966,16 +6200,16 @@ var colorFieldController = (props) => {
5966
6200
  };
5967
6201
 
5968
6202
  // src/widget/basic/binary-field/controller.ts
5969
- var import_react23 = require("react");
5970
- var import_interface_logic23 = require("@fctc/interface-logic");
6203
+ var import_react27 = require("react");
6204
+ var import_interface_logic26 = require("@fctc/interface-logic");
5971
6205
  var binaryFieldController = (props) => {
5972
6206
  const { name, methods, readonly = false, value } = props;
5973
- const inputId = (0, import_react23.useId)();
5974
- const [selectedImage, setSelectedImage] = (0, import_react23.useState)(null);
5975
- const [initialImage, setInitialImage] = (0, import_react23.useState)(value || null);
5976
- const [isInsideTable, setIsInsideTable] = (0, import_react23.useState)(false);
6207
+ const inputId = (0, import_react27.useId)();
6208
+ const [selectedImage, setSelectedImage] = (0, import_react27.useState)(null);
6209
+ const [initialImage, setInitialImage] = (0, import_react27.useState)(value || null);
6210
+ const [isInsideTable, setIsInsideTable] = (0, import_react27.useState)(false);
5977
6211
  const { setValue } = methods;
5978
- const binaryRef = (0, import_react23.useRef)(null);
6212
+ const binaryRef = (0, import_react27.useRef)(null);
5979
6213
  const convertUrlToBase64 = async (url) => {
5980
6214
  try {
5981
6215
  const response = await fetch(url);
@@ -6024,11 +6258,11 @@ var binaryFieldController = (props) => {
6024
6258
  };
6025
6259
  const checkIsImageLink = (url) => {
6026
6260
  const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
6027
- return imageExtensions.test(url) || (0, import_interface_logic23.isBase64Image)(url) || isBlobUrl(url);
6261
+ return imageExtensions.test(url) || (0, import_interface_logic26.isBase64Image)(url) || isBlobUrl(url);
6028
6262
  };
6029
6263
  const getImageBase64WithMimeType = (base64) => {
6030
6264
  if (typeof base64 !== "string" || base64.length < 10) return null;
6031
- if ((0, import_interface_logic23.isBase64Image)(base64)) return base64;
6265
+ if ((0, import_interface_logic26.isBase64Image)(base64)) return base64;
6032
6266
  let mimeType = null;
6033
6267
  if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
6034
6268
  else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
@@ -6037,14 +6271,14 @@ var binaryFieldController = (props) => {
6037
6271
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
6038
6272
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
6039
6273
  };
6040
- (0, import_react23.useEffect)(() => {
6274
+ (0, import_react27.useEffect)(() => {
6041
6275
  return () => {
6042
6276
  if (selectedImage) {
6043
6277
  URL.revokeObjectURL(selectedImage);
6044
6278
  }
6045
6279
  };
6046
6280
  }, [selectedImage]);
6047
- (0, import_react23.useEffect)(() => {
6281
+ (0, import_react27.useEffect)(() => {
6048
6282
  if (binaryRef.current) {
6049
6283
  const isInsideTable2 = !!binaryRef.current.closest("table");
6050
6284
  setIsInsideTable(isInsideTable2);
@@ -6066,6 +6300,7 @@ var binaryFieldController = (props) => {
6066
6300
  0 && (module.exports = {
6067
6301
  API_APP_URL,
6068
6302
  API_PRESCHOOL_URL,
6303
+ AppProvider,
6069
6304
  CloseIcon,
6070
6305
  EyeIcon,
6071
6306
  LoadingIcon,
@@ -6092,17 +6327,22 @@ var binaryFieldController = (props) => {
6092
6327
  priorityFieldController,
6093
6328
  setStorageItemAsync,
6094
6329
  statusDropdownController,
6330
+ useAppProvider,
6095
6331
  useAuth,
6096
6332
  useCallAction,
6097
6333
  useClickOutside,
6098
6334
  useConfig,
6099
6335
  useDebounce,
6100
6336
  useDetail,
6337
+ useForgotPasswordHandler,
6101
6338
  useGetRowIds,
6102
6339
  useListData,
6340
+ useLoginHandler,
6103
6341
  useMenu,
6104
6342
  useProfile,
6343
+ useResetPasswordHandler,
6105
6344
  useStorageState,
6345
+ useSwitchLocaleHandler,
6106
6346
  useUser,
6107
6347
  useViewV2
6108
6348
  });