@fctc/interface-logic 4.2.5 → 4.2.7

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/services.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/services/action-service/index.ts
2
- import { useCallback as useCallback4 } from "react";
2
+ import { useCallback as useCallback32 } from "react";
3
3
 
4
4
  // src/constants/api/uri-constant.ts
5
5
  var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
@@ -3057,110 +3057,26 @@ import { useMutation as useMutation49 } from "@tanstack/react-query";
3057
3057
  // src/hooks/view/use-verify-totp.ts
3058
3058
  import { useMutation as useMutation50 } from "@tanstack/react-query";
3059
3059
 
3060
- // src/hooks/view/use-get-a-session.ts
3061
- import { useMutation as useMutation51 } from "@tanstack/react-query";
3062
-
3063
- // src/hooks/view/use-update-closed-session.ts
3064
- import { useMutation as useMutation52 } from "@tanstack/react-query";
3065
-
3066
- // src/hooks/view/use-manage-session.ts
3067
- import { useMutation as useMutation53 } from "@tanstack/react-query";
3068
-
3069
- // src/hooks/view/use-handle-closing-session.ts
3070
- import { useMutation as useMutation54 } from "@tanstack/react-query";
3071
-
3072
- // src/hooks/view/use-create-session.ts
3073
- import { useMutation as useMutation55 } from "@tanstack/react-query";
3074
-
3075
- // src/hooks/view/use-get-pos.ts
3076
- import { useMutation as useMutation56 } from "@tanstack/react-query";
3077
-
3078
- // src/hooks/view/use-create-entity.ts
3079
- import { useMutation as useMutation57 } from "@tanstack/react-query";
3080
-
3081
- // src/hooks/view/use-get-list.ts
3082
- import { useMutation as useMutation58 } from "@tanstack/react-query";
3083
-
3084
- // src/hooks/view/use-update-entity.ts
3085
- import { useMutation as useMutation59 } from "@tanstack/react-query";
3086
-
3087
- // src/hooks/view/use-delete-entity.ts
3088
- import { useMutation as useMutation60 } from "@tanstack/react-query";
3089
-
3090
- // src/hooks/view/use-load-data-pos-session.ts
3091
- import { useMutation as useMutation61 } from "@tanstack/react-query";
3092
-
3093
- // src/hooks/view/use-manage-on-change.ts
3094
- import { useMutation as useMutation62 } from "@tanstack/react-query";
3095
-
3096
3060
  // src/hooks/view/use-gen-serial-number.ts
3097
- import { useMutation as useMutation63 } from "@tanstack/react-query";
3098
-
3099
- // src/hooks/view/use-get-order-line.ts
3100
- import { useMutation as useMutation64 } from "@tanstack/react-query";
3101
-
3102
- // src/hooks/view/use-get-product-image.ts
3103
- import { useMutation as useMutation65 } from "@tanstack/react-query";
3104
-
3105
- // src/hooks/view/use-check-payment.ts
3106
- import { useMutation as useMutation66 } from "@tanstack/react-query";
3107
-
3108
- // src/hooks/view/use-handle-close-session.ts
3109
- import { useMutation as useMutation67 } from "@tanstack/react-query";
3110
-
3111
- // src/hooks/view/use-handle-closing-detail-session.ts
3112
- import { useMutation as useMutation68 } from "@tanstack/react-query";
3113
-
3114
- // src/hooks/view/use-create-pos-config.ts
3115
- import { useMutation as useMutation69 } from "@tanstack/react-query";
3116
-
3117
- // src/hooks/view/use-search-journal.ts
3118
- import { useMutation as useMutation70 } from "@tanstack/react-query";
3119
-
3120
- // src/hooks/view/useGetPreparaionDisplayData.ts
3121
- import { useMutation as useMutation71 } from "@tanstack/react-query";
3122
-
3123
- // src/hooks/view/useChangeOrderPreparaionState.ts
3124
- import { useMutation as useMutation72 } from "@tanstack/react-query";
3125
-
3126
- // src/hooks/view/use-update-order-status.ts
3127
- import { useMutation as useMutation73 } from "@tanstack/react-query";
3128
-
3129
- // src/hooks/view/use-process-order.ts
3130
- import { useMutation as useMutation74 } from "@tanstack/react-query";
3131
-
3132
- // src/hooks/view/use-generate-payment-qr-info.ts
3133
- import { useMutation as useMutation75 } from "@tanstack/react-query";
3134
-
3135
- // src/hooks/view/use-save-pin-code.ts
3136
- import { useMutation as useMutation76 } from "@tanstack/react-query";
3137
-
3138
- // src/hooks/view/use-get-pin-code.ts
3139
- import { useMutation as useMutation77 } from "@tanstack/react-query";
3061
+ import { useMutation as useMutation51 } from "@tanstack/react-query";
3140
3062
 
3141
3063
  // src/hooks/view/use-get-notifications.ts
3142
3064
  import { useQuery as useQuery23 } from "@tanstack/react-query";
3143
3065
 
3144
3066
  // src/hooks/view/use-get-version.ts
3145
- import { useMutation as useMutation78 } from "@tanstack/react-query";
3146
-
3147
- // src/hooks/view/use-create-e-invoice.ts
3148
- import { useMutation as useMutation79 } from "@tanstack/react-query";
3149
-
3150
- // src/hooks/view/use-get-current-user.ts
3151
- import { useMutation as useMutation80 } from "@tanstack/react-query";
3067
+ import { useMutation as useMutation52 } from "@tanstack/react-query";
3152
3068
 
3153
3069
  // src/hooks/view/use-get-ward.ts
3154
- import { useMutation as useMutation81 } from "@tanstack/react-query";
3070
+ import { useMutation as useMutation53 } from "@tanstack/react-query";
3155
3071
 
3156
3072
  // src/hooks/view/use-get-city.ts
3157
- import { useMutation as useMutation82 } from "@tanstack/react-query";
3073
+ import { useMutation as useMutation54 } from "@tanstack/react-query";
3158
3074
 
3159
3075
  // src/hooks/view/use-get-country.ts
3160
- import { useMutation as useMutation83 } from "@tanstack/react-query";
3076
+ import { useMutation as useMutation55 } from "@tanstack/react-query";
3161
3077
 
3162
3078
  // src/hooks/view/use-get-partner-title.ts
3163
- import { useMutation as useMutation84 } from "@tanstack/react-query";
3079
+ import { useMutation as useMutation56 } from "@tanstack/react-query";
3164
3080
 
3165
3081
  // src/hooks/chart/use-read-group.ts
3166
3082
  import { useQuery as useQuery24 } from "@tanstack/react-query";
@@ -3169,184 +3085,189 @@ import { useQuery as useQuery24 } from "@tanstack/react-query";
3169
3085
  import { useQuery as useQuery25 } from "@tanstack/react-query";
3170
3086
 
3171
3087
  // src/hooks/pos/use-add-entity.ts
3172
- import { useMutation as useMutation85 } from "@tanstack/react-query";
3088
+ import { useMutation as useMutation57 } from "@tanstack/react-query";
3173
3089
 
3174
- // src/services/pos-service/add-entity.ts
3090
+ // src/services/pos-service/get-a-session.ts
3175
3091
  import { useCallback as useCallback3 } from "react";
3176
-
3177
- // src/provider/service-provider.tsx
3178
- import { jsx as jsx6 } from "react/jsx-runtime";
3179
- var ServiceContext = createContext2(null);
3180
-
3181
- // src/provider/meta-provider.tsx
3182
- import { useEffect as useEffect3 } from "react";
3183
- import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
3184
-
3185
- // src/services/action-service/index.ts
3186
- function useActionService() {
3187
- const { env } = useEnv();
3188
- const loadAction = useCallback4(
3092
+ var getASessionService = (env) => {
3093
+ const getASession = useCallback3(
3189
3094
  async ({
3190
- idAction,
3191
- context,
3095
+ model,
3096
+ args,
3097
+ domain,
3192
3098
  service,
3193
- xNode,
3194
- searchParams
3099
+ xNode
3195
3100
  }) => {
3196
3101
  const jsonData = {
3197
- action_id: idAction,
3198
- with_context: { ...context }
3102
+ model,
3103
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3104
+ args,
3105
+ kwargs: {
3106
+ domain: [domain],
3107
+ specification: {
3108
+ name: {},
3109
+ user_id: {},
3110
+ config_id: {},
3111
+ start_at: {},
3112
+ stop_at: {},
3113
+ sequence_number: {},
3114
+ login_number: {},
3115
+ payment_method_ids: {},
3116
+ state: {},
3117
+ update_stock_at_closing: {},
3118
+ cash_register_balance_start: {}
3119
+ }
3120
+ }
3199
3121
  };
3200
- const url = searchParams ? `${"/load_action" /* LOAD_ACTION */}?${toQueryString(searchParams)}` : "/load_action" /* LOAD_ACTION */;
3201
- return env.requests.post(
3202
- url,
3122
+ return env?.requests.post(
3123
+ "/call" /* CALL_PATH */,
3203
3124
  jsonData,
3204
3125
  {
3205
- headers: { "Content-Type": "application/json", "X-Node": xNode }
3126
+ headers: {
3127
+ "Content-Type": "application/json",
3128
+ ...xNode ? { "X-Node": xNode } : {}
3129
+ }
3206
3130
  },
3207
3131
  service
3208
3132
  );
3209
3133
  },
3210
3134
  [env]
3211
3135
  );
3212
- const callButton = useCallback4(
3213
- async ({
3136
+ return {
3137
+ getASession
3138
+ };
3139
+ };
3140
+
3141
+ // src/services/pos-service/add-entity.ts
3142
+ import { useCallback as useCallback4 } from "react";
3143
+ var addEntityService = (env) => {
3144
+ const addEntity = useCallback4(
3145
+ ({
3214
3146
  model,
3215
- ids = [],
3216
- context,
3217
- method,
3147
+ values,
3148
+ xNode,
3218
3149
  service,
3219
- xNode
3150
+ isCreateEndpoint = false
3220
3151
  }) => {
3221
- try {
3222
- const jsonData = {
3223
- model,
3224
- method,
3225
- ids,
3226
- with_context: context
3227
- };
3228
- return env.requests.post(
3229
- "/call" /* CALL_PATH */,
3230
- jsonData,
3231
- {
3232
- headers: {
3233
- "Content-Type": "application/json",
3234
- ...xNode ? { "X-Node": xNode } : {}
3235
- }
3236
- },
3237
- service
3238
- );
3239
- } catch (error) {
3240
- console.error("Error when calling button action:", error);
3241
- throw error;
3242
- }
3152
+ const jsonData = {
3153
+ model,
3154
+ values
3155
+ };
3156
+ return env?.requests.post(
3157
+ isCreateEndpoint ? "/create" /* CREATE_PATH */ : "/call" /* CALL_PATH */,
3158
+ jsonData,
3159
+ {
3160
+ headers: {
3161
+ "Content-Type": "application/json",
3162
+ ...xNode ? { "X-Node": xNode } : {}
3163
+ }
3164
+ },
3165
+ service
3166
+ );
3243
3167
  },
3244
3168
  [env]
3245
3169
  );
3246
- const removeRows = useCallback4(
3247
- async ({
3248
- model,
3249
- ids,
3250
- context,
3251
- service,
3252
- xNode
3170
+ return {
3171
+ addEntity
3172
+ };
3173
+ };
3174
+
3175
+ // src/services/pos-service/change-order-preparation-state.ts
3176
+ import { useCallback as useCallback5 } from "react";
3177
+ var changOrderPreparationStateService = (env) => {
3178
+ const changeOrderPreparationState = useCallback5(
3179
+ ({
3180
+ orderId,
3181
+ stageId,
3182
+ preparationDisplayId,
3183
+ xNode,
3184
+ service
3253
3185
  }) => {
3254
3186
  const jsonData = {
3255
- model,
3256
- method: "unlink",
3257
- ids,
3258
- with_context: context
3187
+ model: "pos_preparation_display.order" /* POS_PREPARATION_ORDER */,
3188
+ method: "change_order_stage" /* CHANGE_ORDER_STAGE */,
3189
+ ids: orderId,
3190
+ kwargs: {
3191
+ stage_id: stageId,
3192
+ preparation_display_id: preparationDisplayId
3193
+ }
3259
3194
  };
3260
- return env.requests.post(
3195
+ return env?.requests.post(
3261
3196
  "/call" /* CALL_PATH */,
3262
3197
  jsonData,
3263
3198
  {
3264
- headers: { "Content-Type": "application/json" },
3265
- ...xNode ? { "X-Node": xNode } : {}
3199
+ headers: {
3200
+ "Content-Type": "application/json",
3201
+ ...xNode ? { "X-Node": xNode } : {}
3202
+ }
3266
3203
  },
3267
3204
  service
3268
3205
  );
3269
3206
  },
3270
3207
  [env]
3271
3208
  );
3272
- const duplicateRecord = useCallback4(
3273
- async ({
3209
+ return {
3210
+ changeOrderPreparationState
3211
+ };
3212
+ };
3213
+
3214
+ // src/services/pos-service/check-payment.ts
3215
+ import { useCallback as useCallback6 } from "react";
3216
+ var checkPaymentService = (env) => {
3217
+ const checkPayment = useCallback6(
3218
+ ({
3274
3219
  model,
3275
- id,
3276
- context,
3277
- service,
3278
- xNode
3220
+ ids,
3221
+ withContext,
3222
+ xNode,
3223
+ service
3279
3224
  }) => {
3280
3225
  const jsonData = {
3281
3226
  model,
3282
- method: "copy",
3283
- ids: id,
3284
- with_context: context
3227
+ method: "check" /* CHECK */,
3228
+ ids,
3229
+ with_context: withContext
3285
3230
  };
3286
- return env.requests.post(
3231
+ return env?.requests.post(
3287
3232
  "/call" /* CALL_PATH */,
3288
3233
  jsonData,
3289
3234
  {
3290
- headers: { "Content-Type": "application/json" },
3291
- ...xNode ? { "X-Node": xNode } : {}
3235
+ headers: {
3236
+ "Content-Type": "application/json",
3237
+ ...xNode ? { "X-Node": xNode } : {}
3238
+ }
3292
3239
  },
3293
3240
  service
3294
3241
  );
3295
3242
  },
3296
3243
  [env]
3297
3244
  );
3298
- const getPrintReportName = useCallback4(
3299
- async ({ id }) => {
3300
- const jsonData = {
3301
- model: "ir.actions.report",
3302
- method: "web_read",
3303
- id,
3304
- kwargs: {
3305
- specification: {
3306
- report_name: {}
3307
- }
3308
- }
3309
- };
3310
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3311
- headers: { "Content-Type": "application/json" }
3312
- });
3313
- },
3314
- [env]
3315
- );
3316
- const print = useCallback4(
3317
- async ({ id, report, db }) => {
3318
- const jsonData = {
3319
- report,
3320
- id,
3321
- type: "pdf",
3322
- file_response: true,
3323
- db
3324
- };
3325
- const queryString = toQueryString(jsonData);
3326
- const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3327
- return env.requests.get(urlWithParams, {
3328
- headers: { "Content-Type": "application/json" },
3329
- responseType: "arraybuffer"
3330
- });
3331
- },
3332
- [env]
3333
- );
3334
- const runAction = useCallback4(
3245
+ return {
3246
+ checkPayment
3247
+ };
3248
+ };
3249
+
3250
+ // src/services/pos-service/create-e-invoice.ts
3251
+ import { useCallback as useCallback7 } from "react";
3252
+ var createEInvoiceService = (env) => {
3253
+ const createEInvoice = useCallback7(
3335
3254
  async ({
3336
- idAction,
3337
- context,
3338
3255
  service,
3339
3256
  xNode,
3340
- searchParams
3257
+ kwargs,
3258
+ ids,
3259
+ withContext
3341
3260
  }) => {
3342
- const jsonData = {
3343
- action_id: idAction,
3344
- with_context: { ...context }
3261
+ const body = {
3262
+ model: "pos.order" /* POS_ORDER */,
3263
+ method: "create_e_invoice" /* CREATE_E_INVOICE */,
3264
+ kwargs,
3265
+ ids,
3266
+ with_context: withContext
3345
3267
  };
3346
- const url = searchParams ? `${"/run_action" /* RUN_ACTION_PATH */}?${toQueryString(searchParams)}` : "/run_action" /* RUN_ACTION_PATH */;
3347
- return env.requests.post(
3348
- url,
3349
- jsonData,
3268
+ return env?.requests?.post(
3269
+ `${"/call" /* CALL_PATH */}`,
3270
+ body,
3350
3271
  {
3351
3272
  headers: {
3352
3273
  "Content-Type": "application/json",
@@ -3358,25 +3279,34 @@ function useActionService() {
3358
3279
  },
3359
3280
  [env]
3360
3281
  );
3361
- const generateSerialNumber = useCallback4(
3362
- async ({
3363
- kwargs,
3364
- context,
3365
- service,
3366
- xNode
3282
+ return {
3283
+ createEInvoice
3284
+ };
3285
+ };
3286
+
3287
+ // src/services/pos-service/create-entity.ts
3288
+ import { useCallback as useCallback8 } from "react";
3289
+ var createEntityService = (env) => {
3290
+ const createEntity = useCallback8(
3291
+ ({
3292
+ model,
3293
+ args,
3294
+ xNode,
3295
+ service
3367
3296
  }) => {
3368
3297
  const jsonData = {
3369
- model: "stock.move",
3370
- method: "action_generate_lot_line_vals",
3371
- with_context: { ...context },
3372
- kwargs
3298
+ model,
3299
+ method: "create" /* CREATE */,
3300
+ args
3373
3301
  };
3374
- return env.requests.post(
3302
+ return env?.requests.post(
3375
3303
  "/call" /* CALL_PATH */,
3376
3304
  jsonData,
3377
3305
  {
3378
- headers: { "Content-Type": "application/json" },
3379
- ...xNode ? { "X-Node": xNode } : {}
3306
+ headers: {
3307
+ "Content-Type": "application/json",
3308
+ ...xNode ? { "X-Node": xNode } : {}
3309
+ }
3380
3310
  },
3381
3311
  service
3382
3312
  );
@@ -3384,234 +3314,352 @@ function useActionService() {
3384
3314
  [env]
3385
3315
  );
3386
3316
  return {
3387
- loadAction,
3388
- callButton,
3389
- removeRows,
3390
- duplicateRecord,
3391
- getPrintReportName,
3392
- print,
3393
- runAction,
3394
- generateSerialNumber
3317
+ createEntity
3395
3318
  };
3396
- }
3319
+ };
3397
3320
 
3398
- // src/services/auth-service/index.ts
3399
- import { useCallback as useCallback5 } from "react";
3400
- function useAuthService() {
3401
- const { env } = useEnv();
3402
- const login = useCallback5(
3403
- async (body) => {
3404
- const payload = Object.fromEntries(
3405
- Object.entries({
3406
- username: body.email,
3407
- password: body.password,
3408
- grant_type: env?.config?.grantType || "",
3409
- client_id: env?.config?.clientId || "",
3410
- client_secret: env?.config?.clientSecret || ""
3411
- }).filter(([_, value]) => !!value)
3412
- );
3413
- const encodedData = new URLSearchParams(payload).toString();
3414
- return env?.requests?.post(
3415
- body.path,
3416
- encodedData,
3321
+ // src/services/pos-service/create-pos-config.ts
3322
+ import { useCallback as useCallback9 } from "react";
3323
+ var createPosConfigService = (env) => {
3324
+ const createPosConfig = useCallback9(
3325
+ ({
3326
+ model,
3327
+ name,
3328
+ modulePosRestaurant,
3329
+ xNode,
3330
+ service
3331
+ }) => {
3332
+ const jsonData = {
3333
+ model,
3334
+ values: {
3335
+ name,
3336
+ module_pos_restaurant: modulePosRestaurant
3337
+ }
3338
+ };
3339
+ return env?.requests.post(
3340
+ "/create" /* CREATE_PATH */,
3341
+ jsonData,
3417
3342
  {
3418
3343
  headers: {
3419
- "Content-Type": "application/x-www-form-urlencoded"
3344
+ "Content-Type": "application/json",
3345
+ ...xNode ? { "X-Node": xNode } : {}
3420
3346
  }
3421
3347
  },
3422
- body.service
3348
+ service
3423
3349
  );
3424
3350
  },
3425
3351
  [env]
3426
3352
  );
3427
- const forgotPassword = useCallback5(
3428
- async (email) => {
3429
- const bodyData = {
3430
- login: email,
3431
- url: `${window.location.origin}/reset-password`
3353
+ return {
3354
+ createPosConfig
3355
+ };
3356
+ };
3357
+
3358
+ // src/services/pos-service/create-session.ts
3359
+ import { useCallback as useCallback10 } from "react";
3360
+ var createSessionService = (env) => {
3361
+ const createSession = useCallback10(
3362
+ ({
3363
+ model,
3364
+ configId,
3365
+ xNode,
3366
+ service
3367
+ }) => {
3368
+ const jsonData = {
3369
+ model,
3370
+ method: "create" /* CREATE */,
3371
+ args: [
3372
+ {
3373
+ config_id: configId
3374
+ }
3375
+ ]
3432
3376
  };
3433
- return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3434
- headers: {
3435
- "Content-Type": "application/json"
3436
- }
3437
- });
3377
+ return env?.requests.post(
3378
+ "/call" /* CALL_PATH */,
3379
+ jsonData,
3380
+ {
3381
+ headers: {
3382
+ "Content-Type": "application/json",
3383
+ ...xNode ? { "X-Node": xNode } : {}
3384
+ }
3385
+ },
3386
+ service
3387
+ );
3438
3388
  },
3439
3389
  [env]
3440
3390
  );
3441
- const forgotPasswordSSO = useCallback5(
3442
- async ({
3443
- email,
3444
- with_context,
3391
+ return {
3392
+ createSession
3393
+ };
3394
+ };
3395
+
3396
+ // src/services/pos-service/delete-entity.ts
3397
+ import { useCallback as useCallback11 } from "react";
3398
+ var deleteEntityService = (env) => {
3399
+ const deleteEntity = useCallback11(
3400
+ ({
3401
+ model,
3402
+ ids,
3403
+ xNode,
3404
+ service,
3445
3405
  method
3446
3406
  }) => {
3447
- const body = {
3448
- method,
3449
- kwargs: {
3450
- vals: {
3451
- email
3407
+ const jsonData = {
3408
+ model,
3409
+ ids,
3410
+ method
3411
+ };
3412
+ return env?.requests.post(
3413
+ "/call" /* CALL_PATH */,
3414
+ jsonData,
3415
+ {
3416
+ headers: {
3417
+ "Content-Type": "application/json",
3418
+ ...xNode ? { "X-Node": xNode } : {}
3452
3419
  }
3453
3420
  },
3454
- with_context
3455
- };
3456
- return env?.requests?.post("/call" /* CALL_PATH */, body, {
3457
- headers: {
3458
- "Content-Type": "application/json"
3459
- }
3460
- });
3421
+ service
3422
+ );
3461
3423
  },
3462
3424
  [env]
3463
3425
  );
3464
- const resetPassword = useCallback5(
3465
- async (data, token) => {
3466
- const bodyData = {
3467
- token,
3468
- password: data.password,
3469
- new_password: data.confirmPassword
3426
+ return {
3427
+ deleteEntity
3428
+ };
3429
+ };
3430
+
3431
+ // src/services/pos-service/generate-payment-qr-info.ts
3432
+ import { useCallback as useCallback12 } from "react";
3433
+ var generatePaymentQrInfoService = (env) => {
3434
+ const generatePaymentQRInfo = useCallback12(
3435
+ ({
3436
+ orderId,
3437
+ amount,
3438
+ posSessionId,
3439
+ xNode,
3440
+ service
3441
+ }) => {
3442
+ const jsonData = {
3443
+ order_id: orderId,
3444
+ amount,
3445
+ pos_session_id: posSessionId
3470
3446
  };
3471
- return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3472
- headers: {
3473
- "Content-Type": "application/json"
3474
- }
3475
- });
3447
+ return env?.requests.post(
3448
+ "/payment/qr" /* PAYMENT_QR */,
3449
+ jsonData,
3450
+ {
3451
+ headers: {
3452
+ "Content-Type": "application/json",
3453
+ ...xNode ? { "X-Node": xNode } : {}
3454
+ }
3455
+ },
3456
+ service
3457
+ );
3476
3458
  },
3477
3459
  [env]
3478
3460
  );
3479
- const resetPasswordSSO = useCallback5(
3461
+ return {
3462
+ generatePaymentQRInfo
3463
+ };
3464
+ };
3465
+
3466
+ // src/services/pos-service/get-current-user.ts
3467
+ import { useCallback as useCallback13 } from "react";
3468
+ var getCurrentUserService = (env) => {
3469
+ const getCurrentUser = useCallback13(
3480
3470
  async ({
3481
- method,
3482
- password,
3483
- with_context
3471
+ service,
3472
+ xNode,
3473
+ oauthUid,
3474
+ extraHeaders
3484
3475
  }) => {
3485
- const bodyData = {
3486
- method,
3487
- kwargs: {
3488
- vals: {
3489
- password
3476
+ return env?.requests?.get(
3477
+ `${"/public/user/info" /* PUBLIC_USER_INFO */}/${oauthUid}`,
3478
+ {
3479
+ headers: extraHeaders ? {
3480
+ ...extraHeaders,
3481
+ "Content-Type": "application/json",
3482
+ ...xNode ? { "X-Node": xNode } : {}
3483
+ } : {
3484
+ "Content-Type": "application/json",
3485
+ ...xNode ? { "X-Node": xNode } : {}
3490
3486
  }
3491
3487
  },
3492
- with_context
3493
- };
3494
- return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3495
- headers: {
3496
- "Content-Type": "application/json"
3497
- }
3498
- });
3499
- },
3500
- [env]
3501
- );
3502
- const updatePassword = useCallback5(
3503
- async (data, token) => {
3504
- const bodyData = {
3505
- token,
3506
- old_password: data.oldPassword,
3507
- new_password: data.newPassword
3508
- };
3509
- return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3510
- headers: {
3511
- "Content-Type": "application/json"
3512
- }
3513
- });
3514
- },
3515
- [env]
3516
- );
3517
- const isValidToken = useCallback5(
3518
- async (token) => {
3519
- const bodyData = {
3520
- token
3521
- };
3522
- return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3523
- headers: {
3524
- "Content-Type": "application/json"
3525
- }
3526
- });
3527
- },
3528
- [env]
3529
- );
3530
- const isValidActionToken = useCallback5(
3531
- async (actionToken) => {
3532
- const bodyData = {};
3533
- return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3534
- headers: {
3535
- "Content-Type": "application/json",
3536
- "X-Use-Action-Token": "true",
3537
- "X-Action-Token": actionToken
3538
- }
3539
- });
3488
+ service
3489
+ );
3540
3490
  },
3541
3491
  [env]
3542
3492
  );
3543
- const loginSocial = useCallback5(
3544
- async ({
3545
- db,
3546
- state,
3547
- access_token
3493
+ return {
3494
+ getCurrentUser
3495
+ };
3496
+ };
3497
+
3498
+ // src/services/pos-service/get-list.ts
3499
+ import { useCallback as useCallback14 } from "react";
3500
+ var getListService = (env) => {
3501
+ const getList = useCallback14(
3502
+ ({
3503
+ model,
3504
+ domain,
3505
+ xNode,
3506
+ service,
3507
+ specification,
3508
+ offset,
3509
+ limit
3548
3510
  }) => {
3549
- return env?.requests?.post(
3550
- "/token/generate" /* GENTOKEN_SOCIAL */,
3551
- { state, access_token },
3511
+ const jsonData = {
3512
+ model,
3513
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3514
+ kwargs: cleanObject({
3515
+ domain,
3516
+ offset,
3517
+ limit,
3518
+ specification
3519
+ })
3520
+ };
3521
+ return env?.requests.post(
3522
+ "/call" /* CALL_PATH */,
3523
+ jsonData,
3552
3524
  {
3553
3525
  headers: {
3554
- "Content-Type": "application/json"
3526
+ "Content-Type": "application/json",
3527
+ ...xNode ? { "X-Node": xNode } : {}
3555
3528
  }
3556
- }
3529
+ },
3530
+ service
3557
3531
  );
3558
3532
  },
3559
3533
  [env]
3560
3534
  );
3561
- const getProviders = useCallback5(
3562
- async (db) => {
3563
- return env?.requests?.get("/oauth/providers", { params: { db } });
3564
- },
3565
- [env]
3566
- );
3567
- const getAccessByCode = useCallback5(
3568
- async (code) => {
3569
- const data = new URLSearchParams();
3570
- data.append("code", code);
3571
- data.append("grant_type", "authorization_code");
3572
- data.append("client_id", env?.config?.clientId || "");
3573
- data.append("redirect_uri", env?.config?.redirectUri || "");
3574
- return env?.requests?.post(
3575
- "/token" /* TOKEN_BY_CODE */,
3576
- data,
3535
+ return {
3536
+ getList
3537
+ };
3538
+ };
3539
+
3540
+ // src/services/pos-service/get-order-line.ts
3541
+ import { useCallback as useCallback15 } from "react";
3542
+ var getOrderLineService = (env) => {
3543
+ const getOrderLine = useCallback15(
3544
+ ({
3545
+ model,
3546
+ ids,
3547
+ specification,
3548
+ xNode,
3549
+ service
3550
+ }) => {
3551
+ const jsonData = {
3552
+ model,
3553
+ method: "web_read" /* WEB_READ */,
3554
+ ids,
3555
+ kwargs: {
3556
+ specification
3557
+ }
3558
+ };
3559
+ return env?.requests.post(
3560
+ "/call" /* CALL_PATH */,
3561
+ jsonData,
3577
3562
  {
3578
3563
  headers: {
3579
- "Content-Type": "application/x-www-form-urlencoded"
3564
+ "Content-Type": "application/json",
3565
+ ...xNode ? { "X-Node": xNode } : {}
3580
3566
  }
3581
3567
  },
3582
- "id"
3568
+ service
3583
3569
  );
3584
3570
  },
3585
3571
  [env]
3586
3572
  );
3587
- const logout = useCallback5(
3588
- async (service) => {
3589
- return env?.requests?.post(
3590
- "/logout" /* LOGOUT */,
3591
- {},
3573
+ return {
3574
+ getOrderLine
3575
+ };
3576
+ };
3577
+
3578
+ // src/services/pos-service/get-pin-code.ts
3579
+ import { useCallback as useCallback16 } from "react";
3580
+ var getPinCodeService = (env) => {
3581
+ const getPinCode = useCallback16(
3582
+ ({
3583
+ serialNumber,
3584
+ xNode,
3585
+ service
3586
+ }) => {
3587
+ const jsonData = {
3588
+ serial_number: serialNumber
3589
+ };
3590
+ return env?.requests.post(
3591
+ "/pos_device/get_pin_code" /* GET_PIN_CODE */,
3592
+ jsonData,
3592
3593
  {
3593
3594
  headers: {
3594
3595
  "Content-Type": "application/json",
3595
- "X-Use-Refresh-Token": "true"
3596
- },
3597
- withCredentials: true
3596
+ ...xNode ? { "X-Node": xNode } : {}
3597
+ }
3598
3598
  },
3599
3599
  service
3600
3600
  );
3601
3601
  },
3602
3602
  [env]
3603
3603
  );
3604
- const getTenantMapping = useCallback5(
3605
- async ({ shortName, service }) => {
3606
- const bodyData = {
3607
- short_name: shortName
3604
+ return {
3605
+ getPinCode
3606
+ };
3607
+ };
3608
+
3609
+ // src/services/pos-service/get-pos.ts
3610
+ import { useCallback as useCallback17 } from "react";
3611
+ var getPosService = (env) => {
3612
+ const getPOS = useCallback17(
3613
+ ({
3614
+ model,
3615
+ args,
3616
+ domain,
3617
+ xNode,
3618
+ service
3619
+ }) => {
3620
+ const jsonData = {
3621
+ model,
3622
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3623
+ args,
3624
+ kwargs: {
3625
+ domain,
3626
+ specification: {
3627
+ cash_control: {},
3628
+ current_session_id: {
3629
+ fields: {
3630
+ display_name: {}
3631
+ }
3632
+ },
3633
+ current_session_state: {},
3634
+ pos_session_state: {},
3635
+ pos_session_duration: {},
3636
+ currency_id: {
3637
+ fields: {
3638
+ display_name: {}
3639
+ }
3640
+ },
3641
+ name: {},
3642
+ pos_session_username: {},
3643
+ last_session_closing_date: {},
3644
+ last_session_closing_cash: {},
3645
+ number_of_rescue_session: {},
3646
+ current_user_id: {
3647
+ fields: {
3648
+ display_name: {}
3649
+ }
3650
+ },
3651
+ customer_display_type: {},
3652
+ module_pos_restaurant: {}
3653
+ }
3654
+ }
3608
3655
  };
3609
3656
  return env?.requests.post(
3610
- "/tenant-mapping" /* TENANT_MAPPING */,
3611
- bodyData,
3657
+ "/call" /* CALL_PATH */,
3658
+ jsonData,
3612
3659
  {
3613
3660
  headers: {
3614
- "Content-Type": "application/json"
3661
+ "Content-Type": "application/json",
3662
+ ...xNode ? { "X-Node": xNode } : {}
3615
3663
  }
3616
3664
  },
3617
3665
  service
@@ -3619,20 +3667,30 @@ function useAuthService() {
3619
3667
  },
3620
3668
  [env]
3621
3669
  );
3622
- const getToken = useCallback5(
3623
- async ({
3624
- phone,
3625
- name,
3670
+ return {
3671
+ getPOS
3672
+ };
3673
+ };
3674
+
3675
+ // src/services/pos-service/get-preparation-display-data.ts
3676
+ import { useCallback as useCallback18 } from "react";
3677
+ var getPreparationDisplayDataService = (env) => {
3678
+ const getPreparationDisplayData = useCallback18(
3679
+ ({
3680
+ ids,
3681
+ xNode,
3626
3682
  service,
3627
- xNode
3683
+ withContext
3628
3684
  }) => {
3629
- const bodyData = {
3630
- phone,
3631
- name
3685
+ const jsonData = {
3686
+ model: "pos_preparation_display.display" /* POS_PREPARATION_DISPLAY */,
3687
+ method: "get_preparation_display_data" /* GET_PREPARATION_DISPLAY_DATA */,
3688
+ ids,
3689
+ with_context: withContext
3632
3690
  };
3633
3691
  return env?.requests.post(
3634
- "/emenu/auth/token" /* EMENU_AUTH_TOKEN */,
3635
- bodyData,
3692
+ "/call" /* CALL_PATH */,
3693
+ jsonData,
3636
3694
  {
3637
3695
  headers: {
3638
3696
  "Content-Type": "application/json",
@@ -3645,66 +3703,39 @@ function useAuthService() {
3645
3703
  [env]
3646
3704
  );
3647
3705
  return {
3648
- login,
3649
- forgotPassword,
3650
- forgotPasswordSSO,
3651
- resetPassword,
3652
- resetPasswordSSO,
3653
- updatePassword,
3654
- isValidToken,
3655
- isValidActionToken,
3656
- loginSocial,
3657
- getProviders,
3658
- getAccessByCode,
3659
- logout,
3660
- getTenantMapping,
3661
- getToken
3706
+ getPreparationDisplayData
3662
3707
  };
3663
- }
3708
+ };
3664
3709
 
3665
- // src/services/company-service/index.ts
3666
- import { useCallback as useCallback6 } from "react";
3667
- function useCompanyService() {
3668
- const { env } = useEnv();
3669
- const getCurrentCompany = useCallback6(
3670
- async (service, extraHeaders) => {
3671
- return await env.requests.get(
3672
- "/company" /* COMPANY_PATH */,
3673
- {
3674
- headers: extraHeaders ? {
3675
- ...extraHeaders,
3676
- "Content-Type": "application/json"
3677
- } : {
3678
- "Content-Type": "application/json"
3679
- }
3680
- },
3681
- service
3682
- );
3683
- },
3684
- [env]
3685
- );
3686
- const getInfoCompany = useCallback6(
3687
- async (id, service) => {
3710
+ // src/services/pos-service/get-product-image.ts
3711
+ import { useCallback as useCallback19 } from "react";
3712
+ var getProductImageService = (env) => {
3713
+ const getProductImage = useCallback19(
3714
+ ({
3715
+ model,
3716
+ fields,
3717
+ limit,
3718
+ offset,
3719
+ domain,
3720
+ xNode,
3721
+ service,
3722
+ searchParams
3723
+ }) => {
3688
3724
  const jsonData = {
3689
- ids: [id],
3690
- model: "res.company" /* COMPANY */,
3691
- method: "web_read" /* WEB_READ */,
3692
- kwargs: {
3693
- specification: {
3694
- primary_color: {},
3695
- secondary_color: {},
3696
- logo: {},
3697
- display_name: {},
3698
- secondary_logo: {}
3699
- }
3700
- }
3725
+ model,
3726
+ fields,
3727
+ limit,
3728
+ offset,
3729
+ domain
3701
3730
  };
3702
- return await env.requests.post(
3703
- "/call" /* CALL_PATH */,
3731
+ const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${toQueryString(searchParams)}` : "/search_read" /* SEARCH_READ */;
3732
+ return env?.requests.post(
3733
+ url,
3704
3734
  jsonData,
3705
3735
  {
3706
3736
  headers: {
3707
- "Content-Type": "application/json"
3737
+ "Content-Type": "application/json",
3738
+ ...xNode ? { "X-Node": xNode } : {}
3708
3739
  }
3709
3740
  },
3710
3741
  service
@@ -3713,220 +3744,223 @@ function useCompanyService() {
3713
3744
  [env]
3714
3745
  );
3715
3746
  return {
3716
- getCurrentCompany,
3717
- getInfoCompany
3747
+ getProductImage
3718
3748
  };
3719
- }
3749
+ };
3720
3750
 
3721
- // src/services/excel-service/index.ts
3722
- import { useCallback as useCallback7 } from "react";
3723
- function useExcelService() {
3724
- const { env } = useEnv();
3725
- const uploadFileExcel = useCallback7(
3726
- async ({
3727
- formData,
3751
+ // src/services/pos-service/handle-close-session.ts
3752
+ import { useCallback as useCallback20 } from "react";
3753
+ var handleCloseSessionService = (env) => {
3754
+ const handleCloseSession = useCallback20(
3755
+ ({
3756
+ model,
3757
+ ids,
3758
+ xNode,
3728
3759
  service,
3729
- xNode
3760
+ method
3730
3761
  }) => {
3731
- return env.requests.post(
3732
- "/upload/file" /* UPLOAD_FILE_EXCEL_PATH */,
3733
- formData,
3762
+ const jsonData = {
3763
+ model,
3764
+ ids,
3765
+ method
3766
+ };
3767
+ return env?.requests.post(
3768
+ "/call" /* CALL_PATH */,
3769
+ jsonData,
3734
3770
  {
3735
- headers: { "X-Node": xNode }
3771
+ headers: {
3772
+ "Content-Type": "application/json",
3773
+ ...xNode ? { "X-Node": xNode } : {}
3774
+ }
3736
3775
  },
3737
3776
  service
3738
3777
  );
3739
3778
  },
3740
3779
  [env]
3741
3780
  );
3742
- const uploadIdFile = useCallback7(
3743
- async ({
3744
- formData,
3781
+ return {
3782
+ handleCloseSession
3783
+ };
3784
+ };
3785
+
3786
+ // src/services/pos-service/handle-closing-detail-session.ts
3787
+ import { useCallback as useCallback21 } from "react";
3788
+ var handleClosingDetailSessionService = (env) => {
3789
+ const handleClosingDetailSession = useCallback21(
3790
+ ({
3791
+ model,
3792
+ ids,
3793
+ method,
3794
+ xNode,
3745
3795
  service,
3746
- xNode
3796
+ kwargs
3747
3797
  }) => {
3748
- return env.requests.post(
3749
- "/upload/file" /* UPLOAD_FILE_EXCEL_PATH */,
3750
- formData,
3798
+ const jsonData = {
3799
+ model,
3800
+ ids,
3801
+ method,
3802
+ kwargs
3803
+ };
3804
+ return env?.requests.post(
3805
+ "/call" /* CALL_PATH */,
3806
+ jsonData,
3751
3807
  {
3752
- headers: { "X-Node": xNode }
3808
+ headers: {
3809
+ "Content-Type": "application/json",
3810
+ ...xNode ? { "X-Node": xNode } : {}
3811
+ }
3753
3812
  },
3754
3813
  service
3755
3814
  );
3756
3815
  },
3757
3816
  [env]
3758
3817
  );
3759
- const parsePreview = useCallback7(
3760
- async ({
3761
- id,
3762
- selectedSheet,
3763
- isHeader,
3764
- context,
3765
- service,
3766
- xNode
3818
+ return {
3819
+ handleClosingDetailSession
3820
+ };
3821
+ };
3822
+
3823
+ // src/services/pos-service/handle-closing-session.ts
3824
+ import { useCallback as useCallback22 } from "react";
3825
+ var handleClosingSessionService = (env) => {
3826
+ const handleClosingSession = useCallback22(
3827
+ ({
3828
+ model,
3829
+ method,
3830
+ ids,
3831
+ kwargs,
3832
+ xNode,
3833
+ service
3767
3834
  }) => {
3768
3835
  const jsonData = {
3769
- model: "base_import.import" /* BASE_IMPORT */,
3770
- method: "parse_preview",
3771
- ids: [id],
3772
- kwargs: {
3773
- options: {
3774
- import_skip_records: [],
3775
- import_set_empty_fields: [],
3776
- fallback_values: {},
3777
- name_create_enabled_fields: {},
3778
- encoding: "",
3779
- separator: "",
3780
- quoting: '"',
3781
- date_format: "",
3782
- datetime_format: "",
3783
- float_thousand_separator: ",",
3784
- float_decimal_separator: ".",
3785
- advanced: true,
3786
- has_headers: isHeader,
3787
- keep_matches: false,
3788
- limit: 2e3,
3789
- sheets: [],
3790
- sheet: selectedSheet,
3791
- skip: 0,
3792
- tracking_disable: true
3793
- }
3794
- },
3795
- with_context: context
3836
+ model,
3837
+ method,
3838
+ ids,
3839
+ kwargs
3796
3840
  };
3797
- return env.requests.post(
3841
+ return env?.requests.post(
3798
3842
  "/call" /* CALL_PATH */,
3799
3843
  jsonData,
3800
3844
  {
3801
- headers: { "Content-Type": "application/json", "X-Node": xNode }
3845
+ headers: {
3846
+ "Content-Type": "application/json",
3847
+ ...xNode ? { "X-Node": xNode } : {}
3848
+ }
3802
3849
  },
3803
3850
  service
3804
3851
  );
3805
3852
  },
3806
3853
  [env]
3807
3854
  );
3808
- const executeImport = useCallback7(
3809
- async ({
3810
- columns,
3811
- fields,
3812
- idFile,
3813
- options,
3814
- dryrun,
3815
- context,
3855
+ return {
3856
+ handleClosingSession
3857
+ };
3858
+ };
3859
+
3860
+ // src/services/pos-service/load-data-pos-session.ts
3861
+ import { useCallback as useCallback23 } from "react";
3862
+ var loadDataPosSessionService = (env) => {
3863
+ const loadDataPosSession = useCallback23(
3864
+ ({
3865
+ model,
3866
+ ids,
3867
+ xNode,
3816
3868
  service,
3817
- xNode
3869
+ withContext,
3870
+ modelsToLoad = [],
3871
+ searchParams
3818
3872
  }) => {
3819
3873
  const jsonData = {
3820
- model: "base_import.import" /* BASE_IMPORT */,
3821
- method: "execute_import",
3822
- ids: [idFile],
3823
- kwargs: {
3824
- fields,
3825
- columns,
3826
- options,
3827
- dryrun
3874
+ model,
3875
+ method: "load_data" /* LOAD_DATA */,
3876
+ ids,
3877
+ with_context: withContext ? withContext : {
3878
+ uid: 37,
3879
+ lang: "vi_VN",
3880
+ tz: "Asia/Saigon"
3828
3881
  },
3829
- with_context: context
3882
+ kwargs: {
3883
+ models_to_load: modelsToLoad
3884
+ }
3830
3885
  };
3831
- return env.requests.post(
3832
- "/call" /* CALL_PATH */,
3886
+ const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
3887
+ return env?.requests.post(
3888
+ url,
3833
3889
  jsonData,
3834
3890
  {
3835
- headers: { "Content-Type": "application/json", "X-Node": xNode }
3891
+ headers: {
3892
+ "Content-Type": "application/json",
3893
+ ...xNode ? { "X-Node": xNode } : {}
3894
+ }
3836
3895
  },
3837
3896
  service
3838
3897
  );
3839
3898
  },
3840
3899
  [env]
3841
3900
  );
3842
- const getFileExcel = useCallback7(
3843
- async ({
3901
+ return {
3902
+ loadDataPosSession
3903
+ };
3904
+ };
3905
+
3906
+ // src/services/pos-service/manage-onchange.ts
3907
+ import { useCallback as useCallback24 } from "react";
3908
+ var manageOnchangeService = (env) => {
3909
+ const manageOnChange = useCallback24(
3910
+ ({
3844
3911
  model,
3845
- service,
3912
+ ids,
3913
+ args,
3846
3914
  xNode,
3847
- context
3915
+ service
3848
3916
  }) => {
3849
3917
  const jsonData = {
3850
3918
  model,
3851
- method: "get_import_templates" /* GET_IMPORT */,
3852
- args: [],
3853
- context
3919
+ method: "onchange" /* ONCHANGE */,
3920
+ ids,
3921
+ args
3854
3922
  };
3855
- return env.requests.post(
3923
+ return env?.requests.post(
3856
3924
  "/call" /* CALL_PATH */,
3857
3925
  jsonData,
3858
3926
  {
3859
- headers: { "Content-Type": "application/json", "X-Node": xNode }
3927
+ headers: {
3928
+ "Content-Type": "application/json",
3929
+ ...xNode ? { "X-Node": xNode } : {}
3930
+ }
3860
3931
  },
3861
3932
  service
3862
3933
  );
3863
3934
  },
3864
3935
  [env]
3865
3936
  );
3866
- const getFieldExport = useCallback7(
3867
- async ({
3868
- ids,
3937
+ return {
3938
+ manageOnChange
3939
+ };
3940
+ };
3941
+
3942
+ // src/services/pos-service/manage-session.ts
3943
+ import { useCallback as useCallback25 } from "react";
3944
+ var manageSessionService = (env) => {
3945
+ const manageSession = useCallback25(
3946
+ ({
3869
3947
  model,
3870
- isShow,
3871
- parentField,
3872
- fieldType,
3873
- parentName,
3874
- prefix,
3875
- name,
3876
- context,
3877
- importCompat,
3878
- service,
3879
- xNode
3880
- }) => {
3881
- const jsonData = {
3882
- model,
3883
- import_compat: importCompat,
3884
- domain: [["id", "in", ids]],
3885
- with_context: context
3886
- };
3887
- if (isShow) {
3888
- jsonData.parent_field = parentField;
3889
- jsonData.parent_field_type = fieldType;
3890
- jsonData.parent_name = parentName;
3891
- jsonData.name = name;
3892
- jsonData.prefix = prefix;
3893
- jsonData.exclude = [null];
3894
- }
3895
- return env.requests.post(
3896
- "/export/get_fields",
3897
- jsonData,
3898
- {
3899
- headers: { "Content-Type": "application/json", "X-Node": xNode }
3900
- },
3901
- service
3902
- );
3903
- },
3904
- [env]
3905
- );
3906
- const exportExcel = useCallback7(
3907
- async ({
3908
- model,
3909
- domain,
3948
+ method,
3910
3949
  ids,
3911
- fields,
3912
- type,
3913
- importCompat,
3914
- context,
3915
- groupby,
3916
- service,
3917
- xNode
3950
+ args,
3951
+ kwargs,
3952
+ xNode,
3953
+ service
3918
3954
  }) => {
3919
3955
  const jsonData = {
3920
3956
  model,
3921
- domain,
3957
+ method,
3922
3958
  ids,
3923
- import_compat: importCompat,
3924
- fields,
3925
- with_context: context,
3926
- groupby: groupby ?? []
3959
+ args,
3960
+ kwargs
3927
3961
  };
3928
- return env.requests.post_excel(
3929
- `/export/${type}`,
3962
+ return env?.requests.post(
3963
+ "/call" /* CALL_PATH */,
3930
3964
  jsonData,
3931
3965
  {
3932
3966
  headers: {
@@ -3940,53 +3974,28 @@ function useExcelService() {
3940
3974
  [env]
3941
3975
  );
3942
3976
  return {
3943
- uploadFileExcel,
3944
- uploadIdFile,
3945
- parsePreview,
3946
- executeImport,
3947
- getFileExcel,
3948
- getFieldExport,
3949
- exportExcel
3977
+ manageSession
3950
3978
  };
3951
- }
3979
+ };
3952
3980
 
3953
- // src/services/form-service/index.ts
3954
- import { useCallback as useCallback8 } from "react";
3955
- function useFormService() {
3956
- const { env } = useEnv();
3957
- const getComment = useCallback8(
3958
- async ({ data }) => {
3959
- const jsonData = {
3960
- thread_id: data.thread_id,
3961
- thread_model: data.thread_model,
3962
- limit: 100,
3963
- with_context: {
3964
- lang: data.lang
3965
- }
3966
- };
3967
- return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3968
- headers: {
3969
- "Content-Type": "application/json"
3970
- }
3971
- });
3972
- },
3973
- [env]
3974
- );
3975
- const getThreadData = useCallback8(
3976
- async ({
3977
- data,
3981
+ // src/services/pos-service/process-order.ts
3982
+ import { useCallback as useCallback26 } from "react";
3983
+ var processOrderService = (env) => {
3984
+ const processOrder = useCallback26(
3985
+ ({
3986
+ orderId,
3978
3987
  xNode,
3979
3988
  service
3980
3989
  }) => {
3981
3990
  const jsonData = {
3982
- thread_id: data?.thread_id,
3983
- thread_model: data?.thread_model,
3984
- limit: data?.limit,
3985
- with_context: data?.with_context,
3986
- request_list: data?.request_list
3991
+ model: "pos_preparation_display.order" /* POS_PREPARATION_ORDER */,
3992
+ method: "process_order" /* PROCESS_ORDER */,
3993
+ kwargs: {
3994
+ order_id: orderId
3995
+ }
3987
3996
  };
3988
- return env.requests.post(
3989
- "/mail/thread/data" /* GET_THREAD_DATA */,
3997
+ return env?.requests.post(
3998
+ "/call" /* CALL_PATH */,
3990
3999
  jsonData,
3991
4000
  {
3992
4001
  headers: {
@@ -3999,20 +4008,27 @@ function useFormService() {
3999
4008
  },
4000
4009
  [env]
4001
4010
  );
4002
- const getThreadMessages = useCallback8(
4003
- async ({
4004
- data,
4011
+ return {
4012
+ processOrder
4013
+ };
4014
+ };
4015
+
4016
+ // src/services/pos-service/save-pin-code.ts
4017
+ import { useCallback as useCallback27 } from "react";
4018
+ var savePinCodeService = (env) => {
4019
+ const savePinCode = useCallback27(
4020
+ ({
4021
+ serialNumber,
4022
+ pinCode,
4005
4023
  xNode,
4006
4024
  service
4007
4025
  }) => {
4008
4026
  const jsonData = {
4009
- thread_id: data?.thread_id,
4010
- thread_model: data?.thread_model,
4011
- limit: data?.limit,
4012
- with_context: data?.with_context
4027
+ serial_number: serialNumber,
4028
+ pin_code: pinCode
4013
4029
  };
4014
- return env.requests.post(
4015
- "/mail/thread/messages" /* GET_THREAD_MESSAGES */,
4030
+ return env?.requests.put(
4031
+ "/pos_device/pin" /* POS_DEVICE_PIN */,
4016
4032
  jsonData,
4017
4033
  {
4018
4034
  headers: {
@@ -4025,74 +4041,70 @@ function useFormService() {
4025
4041
  },
4026
4042
  [env]
4027
4043
  );
4028
- const sentComment = useCallback8(
4029
- async ({ data }) => {
4030
- const jsonData = {
4031
- context: {
4032
- tz: "Asia/Saigon",
4033
- uid: 2,
4034
- allowed_company_ids: [1],
4035
- mail_post_autofollow: false,
4036
- temporary_id: 142183.01
4037
- },
4038
- post_data: {
4039
- body: data.message,
4040
- message_type: "comment",
4041
- attachment_ids: data.attachment_ids,
4042
- attachment_tokens: [],
4043
- subtype_xmlid: data.subtype
4044
- },
4045
- thread_id: Number(data.thread_id),
4046
- thread_model: data.thread_model
4047
- };
4048
- return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
4049
- headers: {
4050
- "Content-Type": "application/json"
4051
- }
4052
- });
4053
- },
4054
- [env]
4055
- );
4056
- const deleteComment = useCallback8(
4057
- async ({ data }) => {
4044
+ return {
4045
+ savePinCode
4046
+ };
4047
+ };
4048
+
4049
+ // src/services/pos-service/search-journal.ts
4050
+ import { useCallback as useCallback28 } from "react";
4051
+ var searchJournalService = (env) => {
4052
+ const searchJournal = useCallback28(
4053
+ ({
4054
+ model,
4055
+ method,
4056
+ args,
4057
+ kwargs,
4058
+ xNode,
4059
+ service
4060
+ }) => {
4058
4061
  const jsonData = {
4059
- attachment_ids: [],
4060
- attachment_tokens: [],
4061
- body: "",
4062
- message_id: data.message_id
4062
+ model,
4063
+ method,
4064
+ args,
4065
+ kwargs
4063
4066
  };
4064
- return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
4065
- headers: {
4066
- "Content-Type": "application/json"
4067
- }
4068
- });
4069
- },
4070
- [env]
4071
- );
4072
- const getImage = useCallback8(
4073
- async ({ data }) => {
4074
- return env.requests.get(
4075
- `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
4067
+ return env?.requests.post(
4068
+ "/call" /* CALL_PATH */,
4069
+ jsonData,
4076
4070
  {
4077
4071
  headers: {
4078
- "Content-Type": "application/json"
4072
+ "Content-Type": "application/json",
4073
+ ...xNode ? { "X-Node": xNode } : {}
4079
4074
  }
4080
- }
4075
+ },
4076
+ service
4081
4077
  );
4082
4078
  },
4083
4079
  [env]
4084
4080
  );
4085
- const uploadImage = useCallback8(
4086
- async ({
4087
- formData,
4081
+ return {
4082
+ searchJournal
4083
+ };
4084
+ };
4085
+
4086
+ // src/services/pos-service/update-closed-session.ts
4087
+ import { useCallback as useCallback29 } from "react";
4088
+ var updateClosedSessionService = (env) => {
4089
+ const updateClosedSession = useCallback29(
4090
+ ({
4091
+ model,
4092
+ domain,
4093
+ values,
4088
4094
  service,
4089
4095
  xNode
4090
4096
  }) => {
4091
- return env.requests.post(
4092
- "/mail/attachment/upload" /* UPLOAD_IMAGE */,
4093
- formData,
4097
+ const jsonData = {
4098
+ model,
4099
+ domain,
4100
+ values
4101
+ };
4102
+ return env?.requests.post(
4103
+ "/create_update" /* CREATE_UPDATE */,
4104
+ jsonData,
4094
4105
  {
4095
4106
  headers: {
4107
+ "Content-Type": "application/json",
4096
4108
  ...xNode ? { "X-Node": xNode } : {}
4097
4109
  }
4098
4110
  },
@@ -4101,18 +4113,34 @@ function useFormService() {
4101
4113
  },
4102
4114
  [env]
4103
4115
  );
4104
- const uploadFile = useCallback8(
4105
- async ({
4106
- formData,
4107
- service,
4116
+ return {
4117
+ updateClosedSession
4118
+ };
4119
+ };
4120
+
4121
+ // src/services/pos-service/update-entity.ts
4122
+ import { useCallback as useCallback30 } from "react";
4123
+ var updateEntityService = (env) => {
4124
+ const updateEntity = useCallback30(
4125
+ ({
4126
+ model,
4127
+ domain,
4128
+ values,
4129
+ isCreateEndpoint = true,
4108
4130
  xNode,
4109
- path
4131
+ service
4110
4132
  }) => {
4111
- return env.requests.post(
4112
- path,
4113
- formData,
4133
+ const jsonData = {
4134
+ model,
4135
+ domain,
4136
+ values
4137
+ };
4138
+ return env?.requests.post(
4139
+ isCreateEndpoint ? "/create_update" /* CREATE_UPDATE */ : "/call" /* CALL_PATH */,
4140
+ jsonData,
4114
4141
  {
4115
4142
  headers: {
4143
+ "Content-Type": "application/json",
4116
4144
  ...xNode ? { "X-Node": xNode } : {}
4117
4145
  }
4118
4146
  },
@@ -4121,59 +4149,28 @@ function useFormService() {
4121
4149
  },
4122
4150
  [env]
4123
4151
  );
4124
- const getFormView = useCallback8(
4125
- async ({ data }) => {
4152
+ return {
4153
+ updateEntity
4154
+ };
4155
+ };
4156
+
4157
+ // src/services/pos-service/update-order-status.ts
4158
+ import { useCallback as useCallback31 } from "react";
4159
+ var updateOrderStatusService = (env) => {
4160
+ const updateOrderStatus = useCallback31(
4161
+ ({
4162
+ orderId,
4163
+ state,
4164
+ xNode,
4165
+ service
4166
+ }) => {
4126
4167
  const jsonData = {
4127
- model: data.model,
4128
- method: "get_formview_action",
4129
- ids: data.id ? [data.id] : [],
4130
- with_context: data.context
4131
- };
4132
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4133
- headers: {
4134
- "Content-Type": "application/json"
4135
- }
4136
- });
4137
- },
4138
- [env]
4139
- );
4140
- const changeStatus = useCallback8(
4141
- async ({ data }) => {
4142
- const vals = {
4143
- [data.name]: data.stage_id
4144
- };
4145
- const jsonData = {
4146
- model: data.model,
4147
- method: "web_save",
4148
- with_context: {
4149
- lang: data.lang,
4150
- allowed_company_ids: [1],
4151
- uid: 2,
4152
- search_default_my_ticket: true,
4153
- search_default_is_open: true
4154
- },
4155
- ids: [data.id],
4156
- kwargs: {
4157
- vals,
4158
- specification: {}
4159
- }
4168
+ order_id: orderId,
4169
+ state
4160
4170
  };
4161
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4162
- headers: {
4163
- "Content-Type": "application/json"
4164
- }
4165
- });
4166
- },
4167
- [env]
4168
- );
4169
- const getExternalTab = useCallback8(
4170
- async ({ method, context, service, xNode }) => {
4171
- return env?.requests?.post(
4172
- "/call" /* CALL_PATH */,
4173
- {
4174
- method,
4175
- with_context: context
4176
- },
4171
+ return env?.requests.put(
4172
+ "/pos-order/status" /* POS_ORDER_STATUS */,
4173
+ jsonData,
4177
4174
  {
4178
4175
  headers: {
4179
4176
  "Content-Type": "application/json",
@@ -4186,213 +4183,393 @@ function useFormService() {
4186
4183
  [env]
4187
4184
  );
4188
4185
  return {
4189
- getComment,
4190
- sentComment,
4191
- deleteComment,
4192
- getImage,
4193
- uploadImage,
4194
- getFormView,
4195
- changeStatus,
4196
- uploadFile,
4197
- getThreadMessages,
4198
- getThreadData,
4199
- getExternalTab
4186
+ updateOrderStatus
4200
4187
  };
4201
- }
4188
+ };
4202
4189
 
4203
- // src/services/kanban-service/index.ts
4204
- import { useCallback as useCallback9 } from "react";
4205
- function useKanbanService() {
4190
+ // src/services/pos-service/index.ts
4191
+ var serviceFactories = [
4192
+ addEntityService,
4193
+ getASessionService,
4194
+ changOrderPreparationStateService,
4195
+ checkPaymentService,
4196
+ createEInvoiceService,
4197
+ createEntityService,
4198
+ createPosConfigService,
4199
+ createSessionService,
4200
+ deleteEntityService,
4201
+ generatePaymentQrInfoService,
4202
+ getCurrentUserService,
4203
+ getListService,
4204
+ getOrderLineService,
4205
+ getPinCodeService,
4206
+ getPosService,
4207
+ getPreparationDisplayDataService,
4208
+ getProductImageService,
4209
+ handleCloseSessionService,
4210
+ handleClosingDetailSessionService,
4211
+ handleClosingSessionService,
4212
+ loadDataPosSessionService,
4213
+ manageOnchangeService,
4214
+ manageSessionService,
4215
+ processOrderService,
4216
+ savePinCodeService,
4217
+ searchJournalService,
4218
+ updateClosedSessionService,
4219
+ updateEntityService,
4220
+ updateOrderStatusService
4221
+ ];
4222
+ var usePosService = () => {
4206
4223
  const { env } = useEnv();
4207
- const getGroups = useCallback9(
4208
- async ({ model, width_context }) => {
4224
+ const service = {};
4225
+ for (const factory of serviceFactories) {
4226
+ const instance = factory(env);
4227
+ Object.assign(service, instance);
4228
+ }
4229
+ return service;
4230
+ };
4231
+
4232
+ // src/hooks/pos/use-get-a-session.ts
4233
+ import { useMutation as useMutation58 } from "@tanstack/react-query";
4234
+
4235
+ // src/hooks/pos/use-change-order-preparation-state.ts
4236
+ import { useMutation as useMutation59 } from "@tanstack/react-query";
4237
+
4238
+ // src/hooks/pos/use-check-payment.ts
4239
+ import { useMutation as useMutation60 } from "@tanstack/react-query";
4240
+
4241
+ // src/hooks/pos/use-create-e-invoice.ts
4242
+ import { useMutation as useMutation61 } from "@tanstack/react-query";
4243
+
4244
+ // src/hooks/pos/use-create-entity.ts
4245
+ import { useMutation as useMutation62 } from "@tanstack/react-query";
4246
+
4247
+ // src/hooks/pos/use-create-pos-config.ts
4248
+ import { useMutation as useMutation63 } from "@tanstack/react-query";
4249
+
4250
+ // src/hooks/pos/use-create-session.ts
4251
+ import { useMutation as useMutation64 } from "@tanstack/react-query";
4252
+
4253
+ // src/hooks/pos/use-delete-entity.ts
4254
+ import { useMutation as useMutation65 } from "@tanstack/react-query";
4255
+
4256
+ // src/hooks/pos/use-generate-payment-qr-info.ts
4257
+ import { useMutation as useMutation66 } from "@tanstack/react-query";
4258
+
4259
+ // src/hooks/pos/use-get-current-user.ts
4260
+ import { useMutation as useMutation67 } from "@tanstack/react-query";
4261
+
4262
+ // src/hooks/pos/use-get-list.ts
4263
+ import { useMutation as useMutation68 } from "@tanstack/react-query";
4264
+
4265
+ // src/hooks/pos/use-get-order-line.ts
4266
+ import { useMutation as useMutation69 } from "@tanstack/react-query";
4267
+
4268
+ // src/hooks/pos/use-get-pin-code.ts
4269
+ import { useMutation as useMutation70 } from "@tanstack/react-query";
4270
+
4271
+ // src/hooks/pos/use-get-pos.ts
4272
+ import { useMutation as useMutation71 } from "@tanstack/react-query";
4273
+
4274
+ // src/hooks/pos/use-get-preparation-display-data.ts
4275
+ import { useMutation as useMutation72 } from "@tanstack/react-query";
4276
+
4277
+ // src/hooks/pos/use-get-product-image.ts
4278
+ import { useMutation as useMutation73 } from "@tanstack/react-query";
4279
+
4280
+ // src/hooks/pos/use-handle-close-session.ts
4281
+ import { useMutation as useMutation74 } from "@tanstack/react-query";
4282
+
4283
+ // src/hooks/pos/use-handle-closing-detail-session.ts
4284
+ import { useMutation as useMutation75 } from "@tanstack/react-query";
4285
+
4286
+ // src/hooks/pos/use-handle-closing-session.ts
4287
+ import { useMutation as useMutation76 } from "@tanstack/react-query";
4288
+
4289
+ // src/hooks/pos/use-load-data-pos-session.ts
4290
+ import { useMutation as useMutation77 } from "@tanstack/react-query";
4291
+
4292
+ // src/hooks/pos/use-manage-onchange.ts
4293
+ import { useMutation as useMutation78 } from "@tanstack/react-query";
4294
+
4295
+ // src/hooks/pos/use-manage-session.ts
4296
+ import { useMutation as useMutation79 } from "@tanstack/react-query";
4297
+
4298
+ // src/hooks/pos/use-process-order.ts
4299
+ import { useMutation as useMutation80 } from "@tanstack/react-query";
4300
+
4301
+ // src/hooks/pos/use-save-pin-code.ts
4302
+ import { useMutation as useMutation81 } from "@tanstack/react-query";
4303
+
4304
+ // src/hooks/pos/use-search-journal.ts
4305
+ import { useMutation as useMutation82 } from "@tanstack/react-query";
4306
+
4307
+ // src/hooks/pos/use-update-closed-session.ts
4308
+ import { useMutation as useMutation83 } from "@tanstack/react-query";
4309
+
4310
+ // src/hooks/pos/use-update-entity.ts
4311
+ import { useMutation as useMutation84 } from "@tanstack/react-query";
4312
+
4313
+ // src/hooks/pos/use-update-order-status.ts
4314
+ import { useMutation as useMutation85 } from "@tanstack/react-query";
4315
+
4316
+ // src/provider/service-provider.tsx
4317
+ import { jsx as jsx6 } from "react/jsx-runtime";
4318
+ var ServiceContext = createContext2(null);
4319
+
4320
+ // src/provider/meta-provider.tsx
4321
+ import { useEffect as useEffect3 } from "react";
4322
+ import { Fragment as Fragment2, jsx as jsx7 } from "react/jsx-runtime";
4323
+
4324
+ // src/services/action-service/index.ts
4325
+ function useActionService() {
4326
+ const { env } = useEnv();
4327
+ const loadAction = useCallback32(
4328
+ async ({
4329
+ idAction,
4330
+ context,
4331
+ service,
4332
+ xNode,
4333
+ searchParams
4334
+ }) => {
4209
4335
  const jsonData = {
4210
- model,
4211
- method: "web_read_group",
4212
- kwargs: {
4213
- domain: [["stage_id.fold", "=", false]],
4214
- fields: ["color:sum"],
4215
- groupby: ["stage_id"]
4216
- },
4217
- width_context
4336
+ action_id: idAction,
4337
+ with_context: { ...context }
4218
4338
  };
4219
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4220
- headers: {
4221
- "Content-Type": "application/json"
4222
- }
4223
- });
4339
+ const url = searchParams ? `${"/load_action" /* LOAD_ACTION */}?${toQueryString(searchParams)}` : "/load_action" /* LOAD_ACTION */;
4340
+ return env.requests.post(
4341
+ url,
4342
+ jsonData,
4343
+ {
4344
+ headers: { "Content-Type": "application/json", "X-Node": xNode }
4345
+ },
4346
+ service
4347
+ );
4224
4348
  },
4225
4349
  [env]
4226
4350
  );
4227
- const getProgressBar = useCallback9(
4228
- async ({ field, color, model, width_context }) => {
4351
+ const callButton = useCallback32(
4352
+ async ({
4353
+ model,
4354
+ ids = [],
4355
+ context,
4356
+ method,
4357
+ service,
4358
+ xNode
4359
+ }) => {
4360
+ try {
4361
+ const jsonData = {
4362
+ model,
4363
+ method,
4364
+ ids,
4365
+ with_context: context
4366
+ };
4367
+ return env.requests.post(
4368
+ "/call" /* CALL_PATH */,
4369
+ jsonData,
4370
+ {
4371
+ headers: {
4372
+ "Content-Type": "application/json",
4373
+ ...xNode ? { "X-Node": xNode } : {}
4374
+ }
4375
+ },
4376
+ service
4377
+ );
4378
+ } catch (error) {
4379
+ console.error("Error when calling button action:", error);
4380
+ throw error;
4381
+ }
4382
+ },
4383
+ [env]
4384
+ );
4385
+ const removeRows = useCallback32(
4386
+ async ({
4387
+ model,
4388
+ ids,
4389
+ context,
4390
+ service,
4391
+ xNode
4392
+ }) => {
4229
4393
  const jsonData = {
4230
4394
  model,
4231
- method: "read_progress_bar",
4232
- kwargs: {
4233
- domain: [],
4234
- group_by: "stage_id",
4235
- progress_bar: {
4236
- colors: color,
4237
- field
4238
- }
4239
- },
4240
- width_context
4395
+ method: "unlink",
4396
+ ids,
4397
+ with_context: context
4241
4398
  };
4242
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4243
- headers: {
4244
- "Content-Type": "application/json"
4245
- }
4246
- });
4399
+ return env.requests.post(
4400
+ "/call" /* CALL_PATH */,
4401
+ jsonData,
4402
+ {
4403
+ headers: { "Content-Type": "application/json" },
4404
+ ...xNode ? { "X-Node": xNode } : {}
4405
+ },
4406
+ service
4407
+ );
4247
4408
  },
4248
4409
  [env]
4249
4410
  );
4250
- return {
4251
- getGroups,
4252
- getProgressBar
4253
- };
4254
- }
4255
-
4256
- // src/services/model-service/index.ts
4257
- import { useCallback as useCallback10 } from "react";
4258
- function useModelService() {
4259
- const { env } = useEnv();
4260
- const getListMyBankAccount = useCallback10(
4411
+ const duplicateRecord = useCallback32(
4261
4412
  async ({
4262
- domain,
4263
- spectification,
4264
- model
4413
+ model,
4414
+ id,
4415
+ context,
4416
+ service,
4417
+ xNode
4265
4418
  }) => {
4266
4419
  const jsonData = {
4267
4420
  model,
4268
- method: "web_search_read",
4421
+ method: "copy",
4422
+ ids: id,
4423
+ with_context: context
4424
+ };
4425
+ return env.requests.post(
4426
+ "/call" /* CALL_PATH */,
4427
+ jsonData,
4428
+ {
4429
+ headers: { "Content-Type": "application/json" },
4430
+ ...xNode ? { "X-Node": xNode } : {}
4431
+ },
4432
+ service
4433
+ );
4434
+ },
4435
+ [env]
4436
+ );
4437
+ const getPrintReportName = useCallback32(
4438
+ async ({ id }) => {
4439
+ const jsonData = {
4440
+ model: "ir.actions.report",
4441
+ method: "web_read",
4442
+ id,
4269
4443
  kwargs: {
4270
- specification: spectification,
4271
- domain,
4272
- limit: 100,
4273
- offset: 0
4444
+ specification: {
4445
+ report_name: {}
4446
+ }
4274
4447
  }
4275
4448
  };
4276
4449
  return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4277
- headers: {
4278
- "Content-Type": "application/json"
4279
- }
4450
+ headers: { "Content-Type": "application/json" }
4280
4451
  });
4281
4452
  },
4282
4453
  [env]
4283
4454
  );
4284
- const getCurrency = useCallback10(async () => {
4285
- const jsonData = {
4286
- model: "res.currency",
4287
- method: "web_search_read",
4288
- kwargs: {
4289
- specification: {
4290
- icon_url: {},
4291
- name: {}
4292
- },
4293
- domain: [["active", "=", true]],
4294
- limit: 100,
4295
- offset: 0
4296
- }
4297
- };
4298
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4299
- headers: {
4300
- "Content-Type": "application/json"
4301
- }
4302
- });
4303
- }, [env]);
4304
- const getConversionRate = useCallback10(async () => {
4305
- const jsonData = {
4306
- model: "res.currency",
4307
- method: "web_search_read",
4308
- kwargs: {
4309
- specification: {
4310
- name: {},
4311
- icon_url: {},
4312
- rate_ids: {
4313
- fields: {
4314
- company_rate: {},
4315
- sell: {}
4316
- }
4317
- }
4318
- },
4319
- domain: [["active", "=", true]],
4320
- limit: 100,
4321
- offset: 0
4322
- }
4323
- };
4324
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4325
- headers: {
4326
- "Content-Type": "application/json"
4327
- }
4328
- });
4329
- }, [env]);
4330
- const getAll = useCallback10(
4455
+ const print = useCallback32(
4456
+ async ({ id, report, db }) => {
4457
+ const jsonData = {
4458
+ report,
4459
+ id,
4460
+ type: "pdf",
4461
+ file_response: true,
4462
+ db
4463
+ };
4464
+ const queryString = toQueryString(jsonData);
4465
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
4466
+ return env.requests.get(urlWithParams, {
4467
+ headers: { "Content-Type": "application/json" },
4468
+ responseType: "arraybuffer"
4469
+ });
4470
+ },
4471
+ [env]
4472
+ );
4473
+ const runAction = useCallback32(
4331
4474
  async ({
4332
- data,
4475
+ idAction,
4476
+ context,
4333
4477
  service,
4334
4478
  xNode,
4335
4479
  searchParams
4336
4480
  }) => {
4337
- const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4338
- fields: data.fields,
4339
- groupby: data.groupby
4340
- } : {
4341
- count_limit: 10001,
4342
- order: data.sort,
4343
- specification: data.specification
4344
- };
4345
4481
  const jsonData = {
4346
- model: String(data.model),
4347
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4348
- ids: data.ids,
4349
- with_context: data.context,
4350
- kwargs: {
4351
- domain: data.domain,
4352
- limit: data.limit,
4353
- offset: data.offset,
4354
- ...jsonReadGroup
4355
- }
4482
+ action_id: idAction,
4483
+ with_context: { ...context }
4356
4484
  };
4357
- const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
4485
+ const url = searchParams ? `${"/run_action" /* RUN_ACTION_PATH */}?${toQueryString(searchParams)}` : "/run_action" /* RUN_ACTION_PATH */;
4358
4486
  return env.requests.post(
4359
4487
  url,
4360
4488
  jsonData,
4361
4489
  {
4362
4490
  headers: {
4363
- "Content-Type": "application/json",
4364
- ...xNode ? { "X-Node": xNode } : {}
4491
+ "Content-Type": "application/json",
4492
+ ...xNode ? { "X-Node": xNode } : {}
4493
+ }
4494
+ },
4495
+ service
4496
+ );
4497
+ },
4498
+ [env]
4499
+ );
4500
+ const generateSerialNumber = useCallback32(
4501
+ async ({
4502
+ kwargs,
4503
+ context,
4504
+ service,
4505
+ xNode
4506
+ }) => {
4507
+ const jsonData = {
4508
+ model: "stock.move",
4509
+ method: "action_generate_lot_line_vals",
4510
+ with_context: { ...context },
4511
+ kwargs
4512
+ };
4513
+ return env.requests.post(
4514
+ "/call" /* CALL_PATH */,
4515
+ jsonData,
4516
+ {
4517
+ headers: { "Content-Type": "application/json" },
4518
+ ...xNode ? { "X-Node": xNode } : {}
4519
+ },
4520
+ service
4521
+ );
4522
+ },
4523
+ [env]
4524
+ );
4525
+ return {
4526
+ loadAction,
4527
+ callButton,
4528
+ removeRows,
4529
+ duplicateRecord,
4530
+ getPrintReportName,
4531
+ print,
4532
+ runAction,
4533
+ generateSerialNumber
4534
+ };
4535
+ }
4536
+
4537
+ // src/services/auth-service/index.ts
4538
+ import { useCallback as useCallback33 } from "react";
4539
+ function useAuthService() {
4540
+ const { env } = useEnv();
4541
+ const login = useCallback33(
4542
+ async (body) => {
4543
+ const payload = Object.fromEntries(
4544
+ Object.entries({
4545
+ username: body.email,
4546
+ password: body.password,
4547
+ grant_type: env?.config?.grantType || "",
4548
+ client_id: env?.config?.clientId || "",
4549
+ client_secret: env?.config?.clientSecret || ""
4550
+ }).filter(([_, value]) => !!value)
4551
+ );
4552
+ const encodedData = new URLSearchParams(payload).toString();
4553
+ return env?.requests?.post(
4554
+ body.path,
4555
+ encodedData,
4556
+ {
4557
+ headers: {
4558
+ "Content-Type": "application/x-www-form-urlencoded"
4365
4559
  }
4366
4560
  },
4367
- service
4561
+ body.service
4368
4562
  );
4369
4563
  },
4370
4564
  [env]
4371
4565
  );
4372
- const getListCalendar = useCallback10(
4373
- async ({ data }) => {
4374
- const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4375
- fields: data.fields,
4376
- groupby: data.groupby
4377
- } : {
4378
- count_limit: 10001,
4379
- order: data.sort,
4380
- specification: data.specification
4381
- };
4382
- const jsonData = {
4383
- model: String(data.model),
4384
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4385
- ids: data.ids,
4386
- with_context: data.context,
4387
- kwargs: {
4388
- domain: data.domain,
4389
- limit: data.limit,
4390
- offset: data.offset,
4391
- fields: data.fields,
4392
- ...jsonReadGroup
4393
- }
4566
+ const forgotPassword = useCallback33(
4567
+ async (email) => {
4568
+ const bodyData = {
4569
+ login: email,
4570
+ url: `${window.location.origin}/reset-password`
4394
4571
  };
4395
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4572
+ return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
4396
4573
  headers: {
4397
4574
  "Content-Type": "application/json"
4398
4575
  }
@@ -4400,31 +4577,37 @@ function useModelService() {
4400
4577
  },
4401
4578
  [env]
4402
4579
  );
4403
- const getList = useCallback10(
4580
+ const forgotPasswordSSO = useCallback33(
4404
4581
  async ({
4405
- model,
4406
- ids = [],
4407
- specification = {},
4408
- domain = [],
4409
- offset,
4410
- order,
4411
- context = {},
4412
- limit = 10
4582
+ email,
4583
+ with_context,
4584
+ method
4413
4585
  }) => {
4414
- const jsonData = {
4415
- model,
4416
- method: "web_search_read" /* WEB_SEARCH_READ */,
4417
- ids,
4418
- with_context: context,
4586
+ const body = {
4587
+ method,
4419
4588
  kwargs: {
4420
- specification,
4421
- domain,
4422
- limit,
4423
- offset,
4424
- order
4589
+ vals: {
4590
+ email
4591
+ }
4592
+ },
4593
+ with_context
4594
+ };
4595
+ return env?.requests?.post("/call" /* CALL_PATH */, body, {
4596
+ headers: {
4597
+ "Content-Type": "application/json"
4425
4598
  }
4599
+ });
4600
+ },
4601
+ [env]
4602
+ );
4603
+ const resetPassword = useCallback33(
4604
+ async (data, token) => {
4605
+ const bodyData = {
4606
+ token,
4607
+ password: data.password,
4608
+ new_password: data.confirmPassword
4426
4609
  };
4427
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4610
+ return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
4428
4611
  headers: {
4429
4612
  "Content-Type": "application/json"
4430
4613
  }
@@ -4432,122 +4615,142 @@ function useModelService() {
4432
4615
  },
4433
4616
  [env]
4434
4617
  );
4435
- const getDetail = useCallback10(
4618
+ const resetPasswordSSO = useCallback33(
4436
4619
  async ({
4437
- ids = [],
4438
- model,
4439
- specification,
4440
- context,
4441
- service,
4442
- xNode
4620
+ method,
4621
+ password,
4622
+ with_context
4443
4623
  }) => {
4444
- const jsonData = {
4445
- model,
4446
- method: "web_read" /* WEB_READ */,
4447
- ids,
4448
- with_context: context,
4624
+ const bodyData = {
4625
+ method,
4449
4626
  kwargs: {
4450
- specification
4451
- }
4452
- };
4453
- return env.requests.post(
4454
- "/call" /* CALL_PATH */,
4455
- jsonData,
4456
- {
4457
- headers: {
4458
- "Content-Type": "application/json",
4459
- ...xNode ? { "X-Node": xNode } : {}
4627
+ vals: {
4628
+ password
4460
4629
  }
4461
4630
  },
4462
- service
4463
- );
4631
+ with_context
4632
+ };
4633
+ return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
4634
+ headers: {
4635
+ "Content-Type": "application/json"
4636
+ }
4637
+ });
4464
4638
  },
4465
4639
  [env]
4466
4640
  );
4467
- const save = useCallback10(
4468
- async ({
4469
- model,
4470
- ids = [],
4471
- data = {},
4472
- specification = {},
4473
- context = {},
4474
- path,
4475
- service,
4476
- xNode
4477
- }) => {
4478
- const jsonData = {
4479
- model,
4480
- method: "web_save" /* WEB_SAVE */,
4481
- with_context: context,
4482
- ids,
4483
- kwargs: {
4484
- vals: data,
4485
- specification
4641
+ const updatePassword = useCallback33(
4642
+ async (data, token) => {
4643
+ const bodyData = {
4644
+ token,
4645
+ old_password: data.oldPassword,
4646
+ new_password: data.newPassword
4647
+ };
4648
+ return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
4649
+ headers: {
4650
+ "Content-Type": "application/json"
4486
4651
  }
4652
+ });
4653
+ },
4654
+ [env]
4655
+ );
4656
+ const isValidToken = useCallback33(
4657
+ async (token) => {
4658
+ const bodyData = {
4659
+ token
4487
4660
  };
4488
- return env.requests.post(
4489
- path ?? "/call" /* CALL_PATH */,
4490
- jsonData,
4661
+ return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
4662
+ headers: {
4663
+ "Content-Type": "application/json"
4664
+ }
4665
+ });
4666
+ },
4667
+ [env]
4668
+ );
4669
+ const isValidActionToken = useCallback33(
4670
+ async (actionToken) => {
4671
+ const bodyData = {};
4672
+ return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
4673
+ headers: {
4674
+ "Content-Type": "application/json",
4675
+ "X-Use-Action-Token": "true",
4676
+ "X-Action-Token": actionToken
4677
+ }
4678
+ });
4679
+ },
4680
+ [env]
4681
+ );
4682
+ const loginSocial = useCallback33(
4683
+ async ({
4684
+ db,
4685
+ state,
4686
+ access_token
4687
+ }) => {
4688
+ return env?.requests?.post(
4689
+ "/token/generate" /* GENTOKEN_SOCIAL */,
4690
+ { state, access_token },
4491
4691
  {
4492
4692
  headers: {
4493
- "Content-Type": "application/json",
4494
- ...xNode ? { "X-Node": xNode } : {}
4693
+ "Content-Type": "application/json"
4495
4694
  }
4496
- },
4497
- service
4695
+ }
4498
4696
  );
4499
4697
  },
4500
4698
  [env]
4501
4699
  );
4502
- const deleteApi = useCallback10(
4503
- async ({ ids = [], model, service }) => {
4504
- const jsonData = {
4505
- model,
4506
- method: "unlink" /* UNLINK */,
4507
- ids
4508
- };
4509
- return env.requests.post(
4510
- "/call" /* CALL_PATH */,
4511
- jsonData,
4700
+ const getProviders = useCallback33(
4701
+ async (db) => {
4702
+ return env?.requests?.get("/oauth/providers", { params: { db } });
4703
+ },
4704
+ [env]
4705
+ );
4706
+ const getAccessByCode = useCallback33(
4707
+ async (code) => {
4708
+ const data = new URLSearchParams();
4709
+ data.append("code", code);
4710
+ data.append("grant_type", "authorization_code");
4711
+ data.append("client_id", env?.config?.clientId || "");
4712
+ data.append("redirect_uri", env?.config?.redirectUri || "");
4713
+ return env?.requests?.post(
4714
+ "/token" /* TOKEN_BY_CODE */,
4715
+ data,
4512
4716
  {
4513
4717
  headers: {
4514
- "Content-Type": "application/json"
4718
+ "Content-Type": "application/x-www-form-urlencoded"
4515
4719
  }
4516
4720
  },
4517
- service
4721
+ "id"
4518
4722
  );
4519
4723
  },
4520
4724
  [env]
4521
4725
  );
4522
- const onChange = useCallback10(
4523
- async ({
4524
- ids = [],
4525
- model,
4526
- object,
4527
- specification,
4528
- context,
4529
- fieldChange,
4530
- service,
4531
- xNode
4532
- }) => {
4533
- const jsonData = {
4534
- model,
4535
- method: "onchange" /* ONCHANGE */,
4536
- ids,
4537
- with_context: context,
4538
- args: [
4539
- object ? object : {},
4540
- fieldChange ? fieldChange : [],
4541
- specification
4542
- ]
4543
- };
4544
- return env.requests.post(
4545
- "/call" /* CALL_PATH */,
4546
- jsonData,
4726
+ const logout = useCallback33(
4727
+ async (service) => {
4728
+ return env?.requests?.post(
4729
+ "/logout" /* LOGOUT */,
4730
+ {},
4547
4731
  {
4548
4732
  headers: {
4549
4733
  "Content-Type": "application/json",
4550
- ...xNode ? { "X-Node": xNode } : {}
4734
+ "X-Use-Refresh-Token": "true"
4735
+ },
4736
+ withCredentials: true
4737
+ },
4738
+ service
4739
+ );
4740
+ },
4741
+ [env]
4742
+ );
4743
+ const getTenantMapping = useCallback33(
4744
+ async ({ shortName, service }) => {
4745
+ const bodyData = {
4746
+ short_name: shortName
4747
+ };
4748
+ return env?.requests.post(
4749
+ "/tenant-mapping" /* TENANT_MAPPING */,
4750
+ bodyData,
4751
+ {
4752
+ headers: {
4753
+ "Content-Type": "application/json"
4551
4754
  }
4552
4755
  },
4553
4756
  service
@@ -4555,19 +4758,20 @@ function useModelService() {
4555
4758
  },
4556
4759
  [env]
4557
4760
  );
4558
- const getListFieldsOnchange = useCallback10(
4761
+ const getToken = useCallback33(
4559
4762
  async ({
4560
- model,
4763
+ phone,
4764
+ name,
4561
4765
  service,
4562
4766
  xNode
4563
4767
  }) => {
4564
- const jsonData = {
4565
- model,
4566
- method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4768
+ const bodyData = {
4769
+ phone,
4770
+ name
4567
4771
  };
4568
- return env.requests.post(
4569
- "/call" /* CALL_PATH */,
4570
- jsonData,
4772
+ return env?.requests.post(
4773
+ "/emenu/auth/token" /* EMENU_AUTH_TOKEN */,
4774
+ bodyData,
4571
4775
  {
4572
4776
  headers: {
4573
4777
  "Content-Type": "application/json",
@@ -4579,92 +4783,38 @@ function useModelService() {
4579
4783
  },
4580
4784
  [env]
4581
4785
  );
4582
- const parseORMOdoo = useCallback10((data) => {
4583
- for (const key in data) {
4584
- if (key === "display_name") {
4585
- delete data[key];
4586
- }
4587
- if (!data[key] && data[key] !== 0) {
4588
- data[key] = false;
4589
- } else if (data[key] === "Draft") {
4590
- data[key] = "/";
4591
- }
4592
- }
4593
- return { ...data };
4594
- }, []);
4595
- const toDataJS = useCallback10(
4596
- (data, viewData, model) => {
4597
- for (const key in data) {
4598
- if (data[key] === false) {
4599
- if (viewData && model) {
4600
- if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4601
- data[key] = null;
4602
- }
4603
- } else {
4604
- data[key] = null;
4605
- }
4606
- } else if (data[key] === "/") {
4607
- data[key] = "Draft";
4608
- } else if (data[key] !== false) {
4609
- if (model !== void 0) {
4610
- if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4611
- data[key] = (data[key] ??= [])?.map((item) => {
4612
- const relation = viewData?.models?.[model]?.[key]?.relation;
4613
- if (relation !== void 0) {
4614
- if (viewData?.models?.[relation]) {
4615
- if (item?.length >= 3) {
4616
- return toDataJS(item[2], viewData, relation);
4617
- } else {
4618
- return toDataJS(item, viewData, relation);
4619
- }
4620
- } else {
4621
- if (item?.length >= 3) {
4622
- return item[2];
4623
- } else if (item !== 0) {
4624
- return item;
4625
- }
4626
- }
4627
- }
4628
- })?.filter(Boolean);
4629
- }
4630
- }
4631
- }
4632
- }
4633
- return { ...data };
4634
- },
4635
- []
4636
- );
4637
4786
  return {
4638
- getListMyBankAccount,
4639
- getCurrency,
4640
- getConversionRate,
4641
- getAll,
4642
- getListCalendar,
4643
- getList,
4644
- getDetail,
4645
- save,
4646
- deleteApi,
4647
- onChange,
4648
- getListFieldsOnchange,
4649
- parseORMOdoo,
4650
- toDataJS
4787
+ login,
4788
+ forgotPassword,
4789
+ forgotPasswordSSO,
4790
+ resetPassword,
4791
+ resetPasswordSSO,
4792
+ updatePassword,
4793
+ isValidToken,
4794
+ isValidActionToken,
4795
+ loginSocial,
4796
+ getProviders,
4797
+ getAccessByCode,
4798
+ logout,
4799
+ getTenantMapping,
4800
+ getToken
4651
4801
  };
4652
4802
  }
4653
4803
 
4654
- // src/services/user-service/index.ts
4655
- import { useCallback as useCallback11 } from "react";
4656
- function useUserService() {
4804
+ // src/services/company-service/index.ts
4805
+ import { useCallback as useCallback34 } from "react";
4806
+ function useCompanyService() {
4657
4807
  const { env } = useEnv();
4658
- const getProfile = useCallback11(
4659
- async (service, path, extraHeaders) => {
4660
- return env?.requests?.get(
4661
- path || "/userinfo" /* PROFILE_PATH */,
4808
+ const getCurrentCompany = useCallback34(
4809
+ async (service, extraHeaders) => {
4810
+ return await env.requests.get(
4811
+ "/company" /* COMPANY_PATH */,
4662
4812
  {
4663
4813
  headers: extraHeaders ? {
4664
4814
  ...extraHeaders,
4665
- "Content-Type": "application/x-www-form-urlencoded"
4815
+ "Content-Type": "application/json"
4666
4816
  } : {
4667
- "Content-Type": "application/x-www-form-urlencoded"
4817
+ "Content-Type": "application/json"
4668
4818
  }
4669
4819
  },
4670
4820
  service
@@ -4672,231 +4822,250 @@ function useUserService() {
4672
4822
  },
4673
4823
  [env]
4674
4824
  );
4675
- const getUser = useCallback11(
4676
- async ({ context, id }) => {
4825
+ const getInfoCompany = useCallback34(
4826
+ async (id, service) => {
4677
4827
  const jsonData = {
4678
- model: "res.users",
4679
- method: "web_read",
4680
4828
  ids: [id],
4681
- with_context: context,
4829
+ model: "res.company" /* COMPANY */,
4830
+ method: "web_read" /* WEB_READ */,
4682
4831
  kwargs: {
4683
4832
  specification: {
4833
+ primary_color: {},
4834
+ secondary_color: {},
4835
+ logo: {},
4684
4836
  display_name: {},
4685
- image_1920: {},
4686
- name: {},
4687
- login: {},
4688
- email: {},
4689
- password: {},
4690
- visible_group_id: {
4691
- fields: {
4692
- id: {},
4693
- display_name: {}
4694
- }
4695
- },
4696
- company_id: {
4697
- fields: {
4698
- id: {},
4699
- display_name: {}
4700
- }
4701
- }
4837
+ secondary_logo: {}
4702
4838
  }
4703
4839
  }
4704
4840
  };
4705
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
4706
- headers: {
4707
- "Content-Type": "application/json"
4708
- }
4709
- });
4841
+ return await env.requests.post(
4842
+ "/call" /* CALL_PATH */,
4843
+ jsonData,
4844
+ {
4845
+ headers: {
4846
+ "Content-Type": "application/json"
4847
+ }
4848
+ },
4849
+ service
4850
+ );
4710
4851
  },
4711
4852
  [env]
4712
4853
  );
4713
- const switchUserLocale = useCallback11(
4714
- async ({ id, values, service }) => {
4854
+ return {
4855
+ getCurrentCompany,
4856
+ getInfoCompany
4857
+ };
4858
+ }
4859
+
4860
+ // src/services/excel-service/index.ts
4861
+ import { useCallback as useCallback35 } from "react";
4862
+ function useExcelService() {
4863
+ const { env } = useEnv();
4864
+ const uploadFileExcel = useCallback35(
4865
+ async ({
4866
+ formData,
4867
+ service,
4868
+ xNode
4869
+ }) => {
4870
+ return env.requests.post(
4871
+ "/upload/file" /* UPLOAD_FILE_EXCEL_PATH */,
4872
+ formData,
4873
+ {
4874
+ headers: { "X-Node": xNode }
4875
+ },
4876
+ service
4877
+ );
4878
+ },
4879
+ [env]
4880
+ );
4881
+ const uploadIdFile = useCallback35(
4882
+ async ({
4883
+ formData,
4884
+ service,
4885
+ xNode
4886
+ }) => {
4887
+ return env.requests.post(
4888
+ "/upload/file" /* UPLOAD_FILE_EXCEL_PATH */,
4889
+ formData,
4890
+ {
4891
+ headers: { "X-Node": xNode }
4892
+ },
4893
+ service
4894
+ );
4895
+ },
4896
+ [env]
4897
+ );
4898
+ const parsePreview = useCallback35(
4899
+ async ({
4900
+ id,
4901
+ selectedSheet,
4902
+ isHeader,
4903
+ context,
4904
+ service,
4905
+ xNode
4906
+ }) => {
4715
4907
  const jsonData = {
4716
- model: "res.users",
4717
- domain: [["id", "=", id]],
4718
- values
4908
+ model: "base_import.import" /* BASE_IMPORT */,
4909
+ method: "parse_preview",
4910
+ ids: [id],
4911
+ kwargs: {
4912
+ options: {
4913
+ import_skip_records: [],
4914
+ import_set_empty_fields: [],
4915
+ fallback_values: {},
4916
+ name_create_enabled_fields: {},
4917
+ encoding: "",
4918
+ separator: "",
4919
+ quoting: '"',
4920
+ date_format: "",
4921
+ datetime_format: "",
4922
+ float_thousand_separator: ",",
4923
+ float_decimal_separator: ".",
4924
+ advanced: true,
4925
+ has_headers: isHeader,
4926
+ keep_matches: false,
4927
+ limit: 2e3,
4928
+ sheets: [],
4929
+ sheet: selectedSheet,
4930
+ skip: 0,
4931
+ tracking_disable: true
4932
+ }
4933
+ },
4934
+ with_context: context
4719
4935
  };
4720
- return env?.requests.post(
4721
- UriConstants?.CREATE_UPDATE_PATH,
4936
+ return env.requests.post(
4937
+ "/call" /* CALL_PATH */,
4722
4938
  jsonData,
4723
4939
  {
4724
- headers: {
4725
- "Content-Type": "application/json"
4726
- }
4940
+ headers: { "Content-Type": "application/json", "X-Node": xNode }
4727
4941
  },
4728
4942
  service
4729
4943
  );
4730
4944
  },
4731
4945
  [env]
4732
4946
  );
4733
- return {
4734
- getProfile,
4735
- getUser,
4736
- switchUserLocale
4737
- };
4738
- }
4739
-
4740
- // src/services/view-service/index.ts
4741
- import { useCallback as useCallback12 } from "react";
4742
- function useViewService() {
4743
- const { env } = useEnv();
4744
- const getView = useCallback12(
4947
+ const executeImport = useCallback35(
4745
4948
  async ({
4746
- model,
4747
- views,
4748
- context = {},
4749
- options = {},
4750
- aid,
4949
+ columns,
4950
+ fields,
4951
+ idFile,
4952
+ options,
4953
+ dryrun,
4954
+ context,
4751
4955
  service,
4752
- xNode,
4753
- searchParams
4956
+ xNode
4754
4957
  }) => {
4755
- const defaultOptions = {
4756
- load_filters: true,
4757
- toolbar: true,
4758
- action_id: aid
4759
- };
4760
- const jsonDataView = {
4761
- model,
4762
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4958
+ const jsonData = {
4959
+ model: "base_import.import" /* BASE_IMPORT */,
4960
+ method: "execute_import",
4961
+ ids: [idFile],
4763
4962
  kwargs: {
4764
- views,
4765
- options: { ...options, ...defaultOptions }
4963
+ fields,
4964
+ columns,
4965
+ options,
4966
+ dryrun
4766
4967
  },
4767
4968
  with_context: context
4768
4969
  };
4769
- const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
4770
- return env?.requests?.post(
4771
- url,
4772
- jsonDataView,
4970
+ return env.requests.post(
4971
+ "/call" /* CALL_PATH */,
4972
+ jsonData,
4773
4973
  {
4774
- headers: {
4775
- "Content-Type": "application/json",
4776
- ...xNode ? { "X-Node": xNode } : {}
4777
- }
4974
+ headers: { "Content-Type": "application/json", "X-Node": xNode }
4778
4975
  },
4779
4976
  service
4780
4977
  );
4781
4978
  },
4782
4979
  [env]
4783
4980
  );
4784
- const getMenu = useCallback12(
4785
- async (context, specification, domain, service) => {
4981
+ const getFileExcel = useCallback35(
4982
+ async ({
4983
+ model,
4984
+ service,
4985
+ xNode,
4986
+ context
4987
+ }) => {
4786
4988
  const jsonData = {
4787
- model: "ir.ui.menu" /* MENU */,
4788
- method: "web_search_read" /* WEB_SEARCH_READ */,
4789
- ids: [],
4790
- with_context: context,
4791
- kwargs: {
4792
- specification,
4793
- domain: domain ?? [
4794
- "&",
4795
- ["is_display", "=", true],
4796
- "&",
4797
- ["active", "=", true],
4798
- ["parent_id", "=", false]
4799
- ]
4800
- }
4989
+ model,
4990
+ method: "get_import_templates" /* GET_IMPORT */,
4991
+ args: [],
4992
+ context
4801
4993
  };
4802
- return env?.requests?.post(
4994
+ return env.requests.post(
4803
4995
  "/call" /* CALL_PATH */,
4804
4996
  jsonData,
4805
4997
  {
4806
- headers: {
4807
- "Content-Type": "application/json"
4808
- }
4998
+ headers: { "Content-Type": "application/json", "X-Node": xNode }
4809
4999
  },
4810
5000
  service
4811
5001
  );
4812
5002
  },
4813
5003
  [env]
4814
5004
  );
4815
- const getActionDetail = useCallback12(
4816
- async (aid, context) => {
4817
- const jsonData = {
4818
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
4819
- method: "web_read" /* WEB_READ */,
4820
- ids: [aid],
4821
- with_context: context,
4822
- kwargs: {
4823
- specification: {
4824
- id: {},
4825
- name: {},
4826
- res_model: {},
4827
- views: {},
4828
- view_mode: {},
4829
- mobile_view_mode: {},
4830
- domain: {},
4831
- context: {},
4832
- groups_id: {},
4833
- search_view_id: {}
4834
- }
4835
- }
4836
- };
4837
- return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4838
- headers: {
4839
- "Content-Type": "application/json"
4840
- }
4841
- });
4842
- },
4843
- [env]
4844
- );
4845
- const getResequence = useCallback12(
5005
+ const getFieldExport = useCallback35(
4846
5006
  async ({
4847
- model,
4848
5007
  ids,
5008
+ model,
5009
+ isShow,
5010
+ parentField,
5011
+ fieldType,
5012
+ parentName,
5013
+ prefix,
5014
+ name,
4849
5015
  context,
4850
- offset,
5016
+ importCompat,
4851
5017
  service,
4852
5018
  xNode
4853
5019
  }) => {
4854
5020
  const jsonData = {
4855
5021
  model,
4856
- with_context: context,
4857
- ids,
4858
- field: "sequence",
4859
- ...offset > 0 ? { offset } : {}
5022
+ import_compat: importCompat,
5023
+ domain: [["id", "in", ids]],
5024
+ with_context: context
4860
5025
  };
4861
- return env?.requests.post(
4862
- "/web/dataset/resequence",
5026
+ if (isShow) {
5027
+ jsonData.parent_field = parentField;
5028
+ jsonData.parent_field_type = fieldType;
5029
+ jsonData.parent_name = parentName;
5030
+ jsonData.name = name;
5031
+ jsonData.prefix = prefix;
5032
+ jsonData.exclude = [null];
5033
+ }
5034
+ return env.requests.post(
5035
+ "/export/get_fields",
4863
5036
  jsonData,
4864
5037
  {
4865
- headers: {
4866
- "Content-Type": "application/json",
4867
- ...xNode ? { "X-Node": xNode } : {}
4868
- }
5038
+ headers: { "Content-Type": "application/json", "X-Node": xNode }
4869
5039
  },
4870
5040
  service
4871
5041
  );
4872
5042
  },
4873
5043
  [env]
4874
5044
  );
4875
- const getSelectionItem = useCallback12(
5045
+ const exportExcel = useCallback35(
4876
5046
  async ({
4877
- data,
5047
+ model,
5048
+ domain,
5049
+ ids,
5050
+ fields,
5051
+ type,
5052
+ importCompat,
5053
+ context,
5054
+ groupby,
4878
5055
  service,
4879
5056
  xNode
4880
5057
  }) => {
4881
5058
  const jsonData = {
4882
- model: data.model,
4883
- ids: [],
4884
- method: "get_data_select",
4885
- with_context: data.context,
4886
- kwargs: {
4887
- count_limit: 10001,
4888
- domain: data.domain ? data.domain : [],
4889
- offset: 0,
4890
- order: "",
4891
- specification: data?.specification ?? {
4892
- id: {},
4893
- name: {},
4894
- display_name: {}
4895
- }
4896
- }
5059
+ model,
5060
+ domain,
5061
+ ids,
5062
+ import_compat: importCompat,
5063
+ fields,
5064
+ with_context: context,
5065
+ groupby: groupby ?? []
4897
5066
  };
4898
- return env?.requests.post(
4899
- "/call" /* CALL_PATH */,
5067
+ return env.requests.post_excel(
5068
+ `/export/${type}`,
4900
5069
  jsonData,
4901
5070
  {
4902
5071
  headers: {
@@ -4909,221 +5078,307 @@ function useViewService() {
4909
5078
  },
4910
5079
  [env]
4911
5080
  );
4912
- const loadMessages = useCallback12(async () => {
4913
- return env.requests.post(
4914
- "/load_message_failures" /* LOAD_MESSAGE */,
4915
- {},
4916
- {
5081
+ return {
5082
+ uploadFileExcel,
5083
+ uploadIdFile,
5084
+ parsePreview,
5085
+ executeImport,
5086
+ getFileExcel,
5087
+ getFieldExport,
5088
+ exportExcel
5089
+ };
5090
+ }
5091
+
5092
+ // src/services/form-service/index.ts
5093
+ import { useCallback as useCallback36 } from "react";
5094
+ function useFormService() {
5095
+ const { env } = useEnv();
5096
+ const getComment = useCallback36(
5097
+ async ({ data }) => {
5098
+ const jsonData = {
5099
+ thread_id: data.thread_id,
5100
+ thread_model: data.thread_model,
5101
+ limit: 100,
5102
+ with_context: {
5103
+ lang: data.lang
5104
+ }
5105
+ };
5106
+ return env.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
4917
5107
  headers: {
4918
5108
  "Content-Type": "application/json"
4919
5109
  }
4920
- }
4921
- );
4922
- }, [env]);
4923
- const getVersion = useCallback12(async () => {
4924
- return env?.requests?.get("", {
4925
- headers: {
4926
- "Content-Type": "application/json"
4927
- }
4928
- });
4929
- }, [env]);
4930
- const grantAccess = useCallback12(
5110
+ });
5111
+ },
5112
+ [env]
5113
+ );
5114
+ const getThreadData = useCallback36(
4931
5115
  async ({
4932
- redirect_uri,
4933
- state,
4934
- client_id,
4935
- scopes
5116
+ data,
5117
+ xNode,
5118
+ service
4936
5119
  }) => {
4937
5120
  const jsonData = {
4938
- redirect_uri,
4939
- state,
4940
- client_id,
4941
- scopes
5121
+ thread_id: data?.thread_id,
5122
+ thread_model: data?.thread_model,
5123
+ limit: data?.limit,
5124
+ with_context: data?.with_context,
5125
+ request_list: data?.request_list
4942
5126
  };
4943
- return env?.requests.post(
4944
- "/grant-access" /* GRANT_ACCESS */,
5127
+ return env.requests.post(
5128
+ "/mail/thread/data" /* GET_THREAD_DATA */,
4945
5129
  jsonData,
4946
5130
  {
4947
5131
  headers: {
4948
- "Content-Type": "application/json"
4949
- },
4950
- withCredentials: true
5132
+ "Content-Type": "application/json",
5133
+ ...xNode ? { "X-Node": xNode } : {}
5134
+ }
4951
5135
  },
4952
- "id"
5136
+ service
4953
5137
  );
4954
5138
  },
4955
5139
  [env]
4956
5140
  );
4957
- const removeTotpSetUp = useCallback12(
4958
- async ({ method, token }) => {
5141
+ const getThreadMessages = useCallback36(
5142
+ async ({
5143
+ data,
5144
+ xNode,
5145
+ service
5146
+ }) => {
4959
5147
  const jsonData = {
4960
- method,
4961
- with_context: {
4962
- token
4963
- }
5148
+ thread_id: data?.thread_id,
5149
+ thread_model: data?.thread_model,
5150
+ limit: data?.limit,
5151
+ with_context: data?.with_context
4964
5152
  };
4965
- return env?.requests.post(
4966
- "/call" /* CALL_PATH */,
5153
+ return env.requests.post(
5154
+ "/mail/thread/messages" /* GET_THREAD_MESSAGES */,
4967
5155
  jsonData,
4968
5156
  {
4969
5157
  headers: {
4970
- "Content-Type": "application/json"
5158
+ "Content-Type": "application/json",
5159
+ ...xNode ? { "X-Node": xNode } : {}
4971
5160
  }
4972
5161
  },
4973
- "id"
5162
+ service
4974
5163
  );
4975
5164
  },
4976
5165
  [env]
4977
5166
  );
4978
- const requestSetupTotp = useCallback12(
4979
- async ({ method, token }) => {
5167
+ const sentComment = useCallback36(
5168
+ async ({ data }) => {
4980
5169
  const jsonData = {
4981
- method,
4982
- with_context: { token }
5170
+ context: {
5171
+ tz: "Asia/Saigon",
5172
+ uid: 2,
5173
+ allowed_company_ids: [1],
5174
+ mail_post_autofollow: false,
5175
+ temporary_id: 142183.01
5176
+ },
5177
+ post_data: {
5178
+ body: data.message,
5179
+ message_type: "comment",
5180
+ attachment_ids: data.attachment_ids,
5181
+ attachment_tokens: [],
5182
+ subtype_xmlid: data.subtype
5183
+ },
5184
+ thread_id: Number(data.thread_id),
5185
+ thread_model: data.thread_model
4983
5186
  };
4984
- return env?.requests.post(
4985
- "/call" /* CALL_PATH */,
4986
- jsonData,
5187
+ return env.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
5188
+ headers: {
5189
+ "Content-Type": "application/json"
5190
+ }
5191
+ });
5192
+ },
5193
+ [env]
5194
+ );
5195
+ const deleteComment = useCallback36(
5196
+ async ({ data }) => {
5197
+ const jsonData = {
5198
+ attachment_ids: [],
5199
+ attachment_tokens: [],
5200
+ body: "",
5201
+ message_id: data.message_id
5202
+ };
5203
+ return env.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
5204
+ headers: {
5205
+ "Content-Type": "application/json"
5206
+ }
5207
+ });
5208
+ },
5209
+ [env]
5210
+ );
5211
+ const getImage = useCallback36(
5212
+ async ({ data }) => {
5213
+ return env.requests.get(
5214
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
4987
5215
  {
4988
5216
  headers: {
4989
5217
  "Content-Type": "application/json"
4990
5218
  }
4991
- },
4992
- "id"
5219
+ }
4993
5220
  );
4994
5221
  },
4995
5222
  [env]
4996
5223
  );
4997
- const settingsWebRead2fa = useCallback12(
5224
+ const uploadImage = useCallback36(
4998
5225
  async ({
4999
- method,
5000
- model,
5001
- kwargs,
5002
- token
5226
+ formData,
5227
+ service,
5228
+ xNode
5003
5229
  }) => {
5004
- const jsonData = {
5005
- method,
5006
- model,
5007
- kwargs,
5008
- with_context: {
5009
- token
5010
- }
5011
- };
5012
- return env?.requests.post(
5013
- "/call" /* CALL_PATH */,
5014
- jsonData,
5230
+ return env.requests.post(
5231
+ "/mail/attachment/upload" /* UPLOAD_IMAGE */,
5232
+ formData,
5015
5233
  {
5016
5234
  headers: {
5017
- "Content-Type": "application/json"
5235
+ ...xNode ? { "X-Node": xNode } : {}
5018
5236
  }
5019
5237
  },
5020
- "id"
5238
+ service
5021
5239
  );
5022
5240
  },
5023
5241
  [env]
5024
5242
  );
5025
- const signInSSO = useCallback12(
5243
+ const uploadFile = useCallback36(
5026
5244
  async ({
5027
- redirect_uri,
5028
- state,
5029
- client_id,
5030
- response_type,
5031
- path,
5032
- scope
5245
+ formData,
5246
+ service,
5247
+ xNode,
5248
+ path
5033
5249
  }) => {
5034
- const params = new URLSearchParams({
5035
- response_type,
5036
- client_id,
5037
- redirect_uri,
5038
- state
5039
- });
5040
- const queryString = `${params.toString()}&scope=${encodeURIComponent(
5041
- scope
5042
- )}`;
5043
- const url = `${path}?${queryString}`;
5044
- return env?.requests.get(
5045
- url,
5250
+ return env.requests.post(
5251
+ path,
5252
+ formData,
5046
5253
  {
5047
5254
  headers: {
5048
- "Content-Type": "application/json"
5049
- },
5050
- withCredentials: true
5255
+ ...xNode ? { "X-Node": xNode } : {}
5256
+ }
5051
5257
  },
5052
- "id"
5258
+ service
5053
5259
  );
5054
5260
  },
5055
5261
  [env]
5056
5262
  );
5057
- const verify2FA = useCallback12(
5058
- ({
5059
- method,
5060
- with_context,
5061
- code,
5062
- device,
5063
- location
5064
- }) => {
5263
+ const getFormView = useCallback36(
5264
+ async ({ data }) => {
5065
5265
  const jsonData = {
5066
- method,
5067
- kwargs: {
5068
- vals: {
5069
- code,
5070
- device,
5071
- location
5072
- }
5073
- },
5074
- with_context
5266
+ model: data.model,
5267
+ method: "get_formview_action",
5268
+ ids: data.id ? [data.id] : [],
5269
+ with_context: data.context
5075
5270
  };
5076
- return env?.requests.post(
5077
- "/call" /* CALL_PATH */,
5078
- jsonData,
5079
- {
5080
- headers: {
5081
- "Content-Type": "application/json"
5082
- },
5083
- withCredentials: true
5084
- },
5085
- "id"
5086
- );
5271
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5272
+ headers: {
5273
+ "Content-Type": "application/json"
5274
+ }
5275
+ });
5087
5276
  },
5088
5277
  [env]
5089
5278
  );
5090
- const get2FAMethods = useCallback12(
5091
- ({ method, with_context }) => {
5279
+ const changeStatus = useCallback36(
5280
+ async ({ data }) => {
5281
+ const vals = {
5282
+ [data.name]: data.stage_id
5283
+ };
5092
5284
  const jsonData = {
5093
- method,
5094
- with_context
5285
+ model: data.model,
5286
+ method: "web_save",
5287
+ with_context: {
5288
+ lang: data.lang,
5289
+ allowed_company_ids: [1],
5290
+ uid: 2,
5291
+ search_default_my_ticket: true,
5292
+ search_default_is_open: true
5293
+ },
5294
+ ids: [data.id],
5295
+ kwargs: {
5296
+ vals,
5297
+ specification: {}
5298
+ }
5095
5299
  };
5096
- return env?.requests.post(
5300
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5301
+ headers: {
5302
+ "Content-Type": "application/json"
5303
+ }
5304
+ });
5305
+ },
5306
+ [env]
5307
+ );
5308
+ const getExternalTab = useCallback36(
5309
+ async ({ method, context, service, xNode }) => {
5310
+ return env?.requests?.post(
5097
5311
  "/call" /* CALL_PATH */,
5098
- jsonData,
5312
+ {
5313
+ method,
5314
+ with_context: context
5315
+ },
5099
5316
  {
5100
5317
  headers: {
5101
- "Content-Type": "application/json"
5318
+ "Content-Type": "application/json",
5319
+ ...xNode ? { "X-Node": xNode } : {}
5102
5320
  }
5103
5321
  },
5104
- "id"
5322
+ service
5105
5323
  );
5106
5324
  },
5107
5325
  [env]
5108
5326
  );
5109
- const verifyTotp = useCallback12(
5110
- ({
5111
- method,
5112
- action_token,
5113
- code
5114
- }) => {
5327
+ return {
5328
+ getComment,
5329
+ sentComment,
5330
+ deleteComment,
5331
+ getImage,
5332
+ uploadImage,
5333
+ getFormView,
5334
+ changeStatus,
5335
+ uploadFile,
5336
+ getThreadMessages,
5337
+ getThreadData,
5338
+ getExternalTab
5339
+ };
5340
+ }
5341
+
5342
+ // src/services/kanban-service/index.ts
5343
+ import { useCallback as useCallback37 } from "react";
5344
+ function useKanbanService() {
5345
+ const { env } = useEnv();
5346
+ const getGroups = useCallback37(
5347
+ async ({ model, width_context }) => {
5348
+ const jsonData = {
5349
+ model,
5350
+ method: "web_read_group",
5351
+ kwargs: {
5352
+ domain: [["stage_id.fold", "=", false]],
5353
+ fields: ["color:sum"],
5354
+ groupby: ["stage_id"]
5355
+ },
5356
+ width_context
5357
+ };
5358
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5359
+ headers: {
5360
+ "Content-Type": "application/json"
5361
+ }
5362
+ });
5363
+ },
5364
+ [env]
5365
+ );
5366
+ const getProgressBar = useCallback37(
5367
+ async ({ field, color, model, width_context }) => {
5115
5368
  const jsonData = {
5116
- method,
5369
+ model,
5370
+ method: "read_progress_bar",
5117
5371
  kwargs: {
5118
- vals: {
5119
- code
5372
+ domain: [],
5373
+ group_by: "stage_id",
5374
+ progress_bar: {
5375
+ colors: color,
5376
+ field
5120
5377
  }
5121
5378
  },
5122
- with_context: {
5123
- action_token
5124
- }
5379
+ width_context
5125
5380
  };
5126
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
5381
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5127
5382
  headers: {
5128
5383
  "Content-Type": "application/json"
5129
5384
  }
@@ -5131,64 +5386,116 @@ function useViewService() {
5131
5386
  },
5132
5387
  [env]
5133
5388
  );
5134
- const getASession = useCallback12(
5389
+ return {
5390
+ getGroups,
5391
+ getProgressBar
5392
+ };
5393
+ }
5394
+
5395
+ // src/services/model-service/index.ts
5396
+ import { useCallback as useCallback38 } from "react";
5397
+ function useModelService() {
5398
+ const { env } = useEnv();
5399
+ const getListMyBankAccount = useCallback38(
5135
5400
  async ({
5136
- model,
5137
- args,
5138
5401
  domain,
5139
- service,
5140
- xNode
5402
+ spectification,
5403
+ model
5141
5404
  }) => {
5142
5405
  const jsonData = {
5143
5406
  model,
5144
- method: "web_search_read" /* WEB_SEARCH_READ */,
5145
- args,
5407
+ method: "web_search_read",
5146
5408
  kwargs: {
5147
- domain: [domain],
5148
- specification: {
5149
- name: {},
5150
- user_id: {},
5151
- config_id: {},
5152
- start_at: {},
5153
- stop_at: {},
5154
- sequence_number: {},
5155
- login_number: {},
5156
- payment_method_ids: {},
5157
- state: {},
5158
- update_stock_at_closing: {},
5159
- cash_register_balance_start: {}
5160
- }
5409
+ specification: spectification,
5410
+ domain,
5411
+ limit: 100,
5412
+ offset: 0
5161
5413
  }
5162
5414
  };
5163
- return env?.requests.post(
5164
- "/call" /* CALL_PATH */,
5165
- jsonData,
5166
- {
5167
- headers: {
5168
- "Content-Type": "application/json",
5169
- ...xNode ? { "X-Node": xNode } : {}
5170
- }
5171
- },
5172
- service
5173
- );
5415
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5416
+ headers: {
5417
+ "Content-Type": "application/json"
5418
+ }
5419
+ });
5174
5420
  },
5175
5421
  [env]
5176
5422
  );
5177
- const updateClosedSession = useCallback12(
5178
- ({
5179
- model,
5180
- domain,
5181
- values,
5423
+ const getCurrency = useCallback38(async () => {
5424
+ const jsonData = {
5425
+ model: "res.currency",
5426
+ method: "web_search_read",
5427
+ kwargs: {
5428
+ specification: {
5429
+ icon_url: {},
5430
+ name: {}
5431
+ },
5432
+ domain: [["active", "=", true]],
5433
+ limit: 100,
5434
+ offset: 0
5435
+ }
5436
+ };
5437
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5438
+ headers: {
5439
+ "Content-Type": "application/json"
5440
+ }
5441
+ });
5442
+ }, [env]);
5443
+ const getConversionRate = useCallback38(async () => {
5444
+ const jsonData = {
5445
+ model: "res.currency",
5446
+ method: "web_search_read",
5447
+ kwargs: {
5448
+ specification: {
5449
+ name: {},
5450
+ icon_url: {},
5451
+ rate_ids: {
5452
+ fields: {
5453
+ company_rate: {},
5454
+ sell: {}
5455
+ }
5456
+ }
5457
+ },
5458
+ domain: [["active", "=", true]],
5459
+ limit: 100,
5460
+ offset: 0
5461
+ }
5462
+ };
5463
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5464
+ headers: {
5465
+ "Content-Type": "application/json"
5466
+ }
5467
+ });
5468
+ }, [env]);
5469
+ const getAll = useCallback38(
5470
+ async ({
5471
+ data,
5182
5472
  service,
5183
- xNode
5473
+ xNode,
5474
+ searchParams
5184
5475
  }) => {
5476
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
5477
+ fields: data.fields,
5478
+ groupby: data.groupby
5479
+ } : {
5480
+ count_limit: 10001,
5481
+ order: data.sort,
5482
+ specification: data.specification
5483
+ };
5185
5484
  const jsonData = {
5186
- model,
5187
- domain,
5188
- values
5485
+ model: String(data.model),
5486
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
5487
+ ids: data.ids,
5488
+ with_context: data.context,
5489
+ kwargs: {
5490
+ domain: data.domain,
5491
+ limit: data.limit,
5492
+ offset: data.offset,
5493
+ ...jsonReadGroup
5494
+ }
5189
5495
  };
5190
- return env?.requests.post(
5191
- "/create_update" /* CREATE_UPDATE */,
5496
+ const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
5497
+ return env.requests.post(
5498
+ url,
5192
5499
  jsonData,
5193
5500
  {
5194
5501
  headers: {
@@ -5201,83 +5508,88 @@ function useViewService() {
5201
5508
  },
5202
5509
  [env]
5203
5510
  );
5204
- const manageSession = useCallback12(
5205
- ({
5206
- model,
5207
- method,
5208
- ids,
5209
- args,
5210
- kwargs,
5211
- xNode,
5212
- service
5213
- }) => {
5511
+ const getListCalendar = useCallback38(
5512
+ async ({ data }) => {
5513
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
5514
+ fields: data.fields,
5515
+ groupby: data.groupby
5516
+ } : {
5517
+ count_limit: 10001,
5518
+ order: data.sort,
5519
+ specification: data.specification
5520
+ };
5214
5521
  const jsonData = {
5215
- model,
5216
- method,
5217
- ids,
5218
- args,
5219
- kwargs
5522
+ model: String(data.model),
5523
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
5524
+ ids: data.ids,
5525
+ with_context: data.context,
5526
+ kwargs: {
5527
+ domain: data.domain,
5528
+ limit: data.limit,
5529
+ offset: data.offset,
5530
+ fields: data.fields,
5531
+ ...jsonReadGroup
5532
+ }
5220
5533
  };
5221
- return env?.requests.post(
5222
- "/call" /* CALL_PATH */,
5223
- jsonData,
5224
- {
5225
- headers: {
5226
- "Content-Type": "application/json",
5227
- ...xNode ? { "X-Node": xNode } : {}
5228
- }
5229
- },
5230
- service
5231
- );
5534
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5535
+ headers: {
5536
+ "Content-Type": "application/json"
5537
+ }
5538
+ });
5232
5539
  },
5233
5540
  [env]
5234
5541
  );
5235
- const handleClosingSession = useCallback12(
5236
- ({
5542
+ const getList = useCallback38(
5543
+ async ({
5237
5544
  model,
5238
- method,
5239
- ids,
5240
- kwargs,
5241
- xNode,
5242
- service
5545
+ ids = [],
5546
+ specification = {},
5547
+ domain = [],
5548
+ offset,
5549
+ order,
5550
+ context = {},
5551
+ limit = 10
5243
5552
  }) => {
5244
5553
  const jsonData = {
5245
5554
  model,
5246
- method,
5555
+ method: "web_search_read" /* WEB_SEARCH_READ */,
5247
5556
  ids,
5248
- kwargs
5557
+ with_context: context,
5558
+ kwargs: {
5559
+ specification,
5560
+ domain,
5561
+ limit,
5562
+ offset,
5563
+ order
5564
+ }
5249
5565
  };
5250
- return env?.requests.post(
5251
- "/call" /* CALL_PATH */,
5252
- jsonData,
5253
- {
5254
- headers: {
5255
- "Content-Type": "application/json",
5256
- ...xNode ? { "X-Node": xNode } : {}
5257
- }
5258
- },
5259
- service
5260
- );
5566
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5567
+ headers: {
5568
+ "Content-Type": "application/json"
5569
+ }
5570
+ });
5261
5571
  },
5262
5572
  [env]
5263
5573
  );
5264
- const createSession = useCallback12(
5265
- ({
5574
+ const getDetail = useCallback38(
5575
+ async ({
5576
+ ids = [],
5266
5577
  model,
5267
- configId,
5268
- xNode,
5269
- service
5578
+ specification,
5579
+ context,
5580
+ service,
5581
+ xNode
5270
5582
  }) => {
5271
5583
  const jsonData = {
5272
- model,
5273
- method: "create" /* CREATE */,
5274
- args: [
5275
- {
5276
- config_id: configId
5277
- }
5278
- ]
5584
+ model,
5585
+ method: "web_read" /* WEB_READ */,
5586
+ ids,
5587
+ with_context: context,
5588
+ kwargs: {
5589
+ specification
5590
+ }
5279
5591
  };
5280
- return env?.requests.post(
5592
+ return env.requests.post(
5281
5593
  "/call" /* CALL_PATH */,
5282
5594
  jsonData,
5283
5595
  {
@@ -5291,52 +5603,29 @@ function useViewService() {
5291
5603
  },
5292
5604
  [env]
5293
5605
  );
5294
- const getPOS = useCallback12(
5295
- ({
5606
+ const save = useCallback38(
5607
+ async ({
5296
5608
  model,
5297
- args,
5298
- domain,
5299
- xNode,
5300
- service
5609
+ ids = [],
5610
+ data = {},
5611
+ specification = {},
5612
+ context = {},
5613
+ path,
5614
+ service,
5615
+ xNode
5301
5616
  }) => {
5302
5617
  const jsonData = {
5303
5618
  model,
5304
- method: "web_search_read" /* WEB_SEARCH_READ */,
5305
- args,
5619
+ method: "web_save" /* WEB_SAVE */,
5620
+ with_context: context,
5621
+ ids,
5306
5622
  kwargs: {
5307
- domain,
5308
- specification: {
5309
- cash_control: {},
5310
- current_session_id: {
5311
- fields: {
5312
- display_name: {}
5313
- }
5314
- },
5315
- current_session_state: {},
5316
- pos_session_state: {},
5317
- pos_session_duration: {},
5318
- currency_id: {
5319
- fields: {
5320
- display_name: {}
5321
- }
5322
- },
5323
- name: {},
5324
- pos_session_username: {},
5325
- last_session_closing_date: {},
5326
- last_session_closing_cash: {},
5327
- number_of_rescue_session: {},
5328
- current_user_id: {
5329
- fields: {
5330
- display_name: {}
5331
- }
5332
- },
5333
- customer_display_type: {},
5334
- module_pos_restaurant: {}
5335
- }
5623
+ vals: data,
5624
+ specification
5336
5625
  }
5337
5626
  };
5338
- return env?.requests.post(
5339
- "/call" /* CALL_PATH */,
5627
+ return env.requests.post(
5628
+ path ?? "/call" /* CALL_PATH */,
5340
5629
  jsonData,
5341
5630
  {
5342
5631
  headers: {
@@ -5349,25 +5638,19 @@ function useViewService() {
5349
5638
  },
5350
5639
  [env]
5351
5640
  );
5352
- const createEntity = useCallback12(
5353
- ({
5354
- model,
5355
- args,
5356
- xNode,
5357
- service
5358
- }) => {
5641
+ const deleteApi = useCallback38(
5642
+ async ({ ids = [], model, service }) => {
5359
5643
  const jsonData = {
5360
5644
  model,
5361
- method: "create" /* CREATE */,
5362
- args
5645
+ method: "unlink" /* UNLINK */,
5646
+ ids
5363
5647
  };
5364
- return env?.requests.post(
5648
+ return env.requests.post(
5365
5649
  "/call" /* CALL_PATH */,
5366
5650
  jsonData,
5367
5651
  {
5368
5652
  headers: {
5369
- "Content-Type": "application/json",
5370
- ...xNode ? { "X-Node": xNode } : {}
5653
+ "Content-Type": "application/json"
5371
5654
  }
5372
5655
  },
5373
5656
  service
@@ -5375,27 +5658,29 @@ function useViewService() {
5375
5658
  },
5376
5659
  [env]
5377
5660
  );
5378
- const getList = useCallback12(
5379
- ({
5661
+ const onChange = useCallback38(
5662
+ async ({
5663
+ ids = [],
5380
5664
  model,
5381
- domain,
5382
- xNode,
5383
- service,
5665
+ object,
5384
5666
  specification,
5385
- offset,
5386
- limit
5667
+ context,
5668
+ fieldChange,
5669
+ service,
5670
+ xNode
5387
5671
  }) => {
5388
5672
  const jsonData = {
5389
5673
  model,
5390
- method: "web_search_read" /* WEB_SEARCH_READ */,
5391
- kwargs: cleanObject({
5392
- domain,
5393
- offset,
5394
- limit,
5674
+ method: "onchange" /* ONCHANGE */,
5675
+ ids,
5676
+ with_context: context,
5677
+ args: [
5678
+ object ? object : {},
5679
+ fieldChange ? fieldChange : [],
5395
5680
  specification
5396
- })
5681
+ ]
5397
5682
  };
5398
- return env?.requests.post(
5683
+ return env.requests.post(
5399
5684
  "/call" /* CALL_PATH */,
5400
5685
  jsonData,
5401
5686
  {
@@ -5409,22 +5694,18 @@ function useViewService() {
5409
5694
  },
5410
5695
  [env]
5411
5696
  );
5412
- const updateEntity = useCallback12(
5413
- ({
5697
+ const getListFieldsOnchange = useCallback38(
5698
+ async ({
5414
5699
  model,
5415
- domain,
5416
- values,
5417
- isCreateEndpoint = true,
5418
- xNode,
5419
- service
5700
+ service,
5701
+ xNode
5420
5702
  }) => {
5421
5703
  const jsonData = {
5422
5704
  model,
5423
- domain,
5424
- values
5705
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
5425
5706
  };
5426
- return env?.requests.post(
5427
- isCreateEndpoint ? "/create_update" /* CREATE_UPDATE */ : "/call" /* CALL_PATH */,
5707
+ return env.requests.post(
5708
+ "/call" /* CALL_PATH */,
5428
5709
  jsonData,
5429
5710
  {
5430
5711
  headers: {
@@ -5437,26 +5718,92 @@ function useViewService() {
5437
5718
  },
5438
5719
  [env]
5439
5720
  );
5440
- const deleteEntity = useCallback12(
5441
- ({
5442
- model,
5443
- ids,
5444
- xNode,
5445
- service,
5446
- method
5447
- }) => {
5448
- const jsonData = {
5449
- model,
5450
- ids,
5451
- method
5452
- };
5453
- return env?.requests.post(
5454
- "/call" /* CALL_PATH */,
5455
- jsonData,
5721
+ const parseORMOdoo = useCallback38((data) => {
5722
+ for (const key in data) {
5723
+ if (key === "display_name") {
5724
+ delete data[key];
5725
+ }
5726
+ if (!data[key] && data[key] !== 0) {
5727
+ data[key] = false;
5728
+ } else if (data[key] === "Draft") {
5729
+ data[key] = "/";
5730
+ }
5731
+ }
5732
+ return { ...data };
5733
+ }, []);
5734
+ const toDataJS = useCallback38(
5735
+ (data, viewData, model) => {
5736
+ for (const key in data) {
5737
+ if (data[key] === false) {
5738
+ if (viewData && model) {
5739
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
5740
+ data[key] = null;
5741
+ }
5742
+ } else {
5743
+ data[key] = null;
5744
+ }
5745
+ } else if (data[key] === "/") {
5746
+ data[key] = "Draft";
5747
+ } else if (data[key] !== false) {
5748
+ if (model !== void 0) {
5749
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
5750
+ data[key] = (data[key] ??= [])?.map((item) => {
5751
+ const relation = viewData?.models?.[model]?.[key]?.relation;
5752
+ if (relation !== void 0) {
5753
+ if (viewData?.models?.[relation]) {
5754
+ if (item?.length >= 3) {
5755
+ return toDataJS(item[2], viewData, relation);
5756
+ } else {
5757
+ return toDataJS(item, viewData, relation);
5758
+ }
5759
+ } else {
5760
+ if (item?.length >= 3) {
5761
+ return item[2];
5762
+ } else if (item !== 0) {
5763
+ return item;
5764
+ }
5765
+ }
5766
+ }
5767
+ })?.filter(Boolean);
5768
+ }
5769
+ }
5770
+ }
5771
+ }
5772
+ return { ...data };
5773
+ },
5774
+ []
5775
+ );
5776
+ return {
5777
+ getListMyBankAccount,
5778
+ getCurrency,
5779
+ getConversionRate,
5780
+ getAll,
5781
+ getListCalendar,
5782
+ getList,
5783
+ getDetail,
5784
+ save,
5785
+ deleteApi,
5786
+ onChange,
5787
+ getListFieldsOnchange,
5788
+ parseORMOdoo,
5789
+ toDataJS
5790
+ };
5791
+ }
5792
+
5793
+ // src/services/user-service/index.ts
5794
+ import { useCallback as useCallback39 } from "react";
5795
+ function useUserService() {
5796
+ const { env } = useEnv();
5797
+ const getProfile = useCallback39(
5798
+ async (service, path, extraHeaders) => {
5799
+ return env?.requests?.get(
5800
+ path || "/userinfo" /* PROFILE_PATH */,
5456
5801
  {
5457
- headers: {
5458
- "Content-Type": "application/json",
5459
- ...xNode ? { "X-Node": xNode } : {}
5802
+ headers: extraHeaders ? {
5803
+ ...extraHeaders,
5804
+ "Content-Type": "application/x-www-form-urlencoded"
5805
+ } : {
5806
+ "Content-Type": "application/x-www-form-urlencoded"
5460
5807
  }
5461
5808
  },
5462
5809
  service
@@ -5464,64 +5811,57 @@ function useViewService() {
5464
5811
  },
5465
5812
  [env]
5466
5813
  );
5467
- const loadDataPosSession = useCallback12(
5468
- ({
5469
- model,
5470
- ids,
5471
- xNode,
5472
- service,
5473
- withContext,
5474
- modelsToLoad = [],
5475
- searchParams
5476
- }) => {
5814
+ const getUser = useCallback39(
5815
+ async ({ context, id }) => {
5477
5816
  const jsonData = {
5478
- model,
5479
- method: "load_data" /* LOAD_DATA */,
5480
- ids,
5481
- with_context: withContext ? withContext : {
5482
- uid: 37,
5483
- lang: "vi_VN",
5484
- tz: "Asia/Saigon"
5485
- },
5817
+ model: "res.users",
5818
+ method: "web_read",
5819
+ ids: [id],
5820
+ with_context: context,
5486
5821
  kwargs: {
5487
- models_to_load: modelsToLoad
5822
+ specification: {
5823
+ display_name: {},
5824
+ image_1920: {},
5825
+ name: {},
5826
+ login: {},
5827
+ email: {},
5828
+ password: {},
5829
+ visible_group_id: {
5830
+ fields: {
5831
+ id: {},
5832
+ display_name: {}
5833
+ }
5834
+ },
5835
+ company_id: {
5836
+ fields: {
5837
+ id: {},
5838
+ display_name: {}
5839
+ }
5840
+ }
5841
+ }
5488
5842
  }
5489
5843
  };
5490
- const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
5491
- return env?.requests.post(
5492
- url,
5493
- jsonData,
5494
- {
5495
- headers: {
5496
- "Content-Type": "application/json",
5497
- ...xNode ? { "X-Node": xNode } : {}
5498
- }
5499
- },
5500
- service
5501
- );
5844
+ return env.requests.post("/call" /* CALL_PATH */, jsonData, {
5845
+ headers: {
5846
+ "Content-Type": "application/json"
5847
+ }
5848
+ });
5502
5849
  },
5503
5850
  [env]
5504
5851
  );
5505
- const getPreparationDisplayData = useCallback12(
5506
- ({
5507
- ids,
5508
- xNode,
5509
- service,
5510
- withContext
5511
- }) => {
5852
+ const switchUserLocale = useCallback39(
5853
+ async ({ id, values, service }) => {
5512
5854
  const jsonData = {
5513
- model: "pos_preparation_display.display" /* POS_PREPARATION_DISPLAY */,
5514
- method: "get_preparation_display_data" /* GET_PREPARATION_DISPLAY_DATA */,
5515
- ids,
5516
- with_context: withContext
5855
+ model: "res.users",
5856
+ domain: [["id", "=", id]],
5857
+ values
5517
5858
  };
5518
5859
  return env?.requests.post(
5519
- "/call" /* CALL_PATH */,
5860
+ UriConstants?.CREATE_UPDATE_PATH,
5520
5861
  jsonData,
5521
5862
  {
5522
5863
  headers: {
5523
- "Content-Type": "application/json",
5524
- ...xNode ? { "X-Node": xNode } : {}
5864
+ "Content-Type": "application/json"
5525
5865
  }
5526
5866
  },
5527
5867
  service
@@ -5529,23 +5869,46 @@ function useViewService() {
5529
5869
  },
5530
5870
  [env]
5531
5871
  );
5532
- const manageOnChange = useCallback12(
5533
- ({
5872
+ return {
5873
+ getProfile,
5874
+ getUser,
5875
+ switchUserLocale
5876
+ };
5877
+ }
5878
+
5879
+ // src/services/view-service/index.ts
5880
+ import { useCallback as useCallback40 } from "react";
5881
+ function useViewService() {
5882
+ const { env } = useEnv();
5883
+ const getView = useCallback40(
5884
+ async ({
5534
5885
  model,
5535
- ids,
5536
- args,
5886
+ views,
5887
+ context = {},
5888
+ options = {},
5889
+ aid,
5890
+ service,
5537
5891
  xNode,
5538
- service
5892
+ searchParams
5539
5893
  }) => {
5540
- const jsonData = {
5894
+ const defaultOptions = {
5895
+ load_filters: true,
5896
+ toolbar: true,
5897
+ action_id: aid
5898
+ };
5899
+ const jsonDataView = {
5541
5900
  model,
5542
- method: "onchange" /* ONCHANGE */,
5543
- ids,
5544
- args
5901
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
5902
+ kwargs: {
5903
+ views,
5904
+ options: { ...options, ...defaultOptions }
5905
+ },
5906
+ with_context: context
5545
5907
  };
5546
- return env?.requests.post(
5547
- "/call" /* CALL_PATH */,
5548
- jsonData,
5908
+ const url = searchParams ? `${"/call" /* CALL_PATH */}?${toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
5909
+ return env?.requests?.post(
5910
+ url,
5911
+ jsonDataView,
5549
5912
  {
5550
5913
  headers: {
5551
5914
  "Content-Type": "application/json",
@@ -5557,29 +5920,30 @@ function useViewService() {
5557
5920
  },
5558
5921
  [env]
5559
5922
  );
5560
- const getOrderLine = useCallback12(
5561
- ({
5562
- model,
5563
- ids,
5564
- specification,
5565
- xNode,
5566
- service
5567
- }) => {
5923
+ const getMenu = useCallback40(
5924
+ async (context, specification, domain, service) => {
5568
5925
  const jsonData = {
5569
- model,
5570
- method: "web_read" /* WEB_READ */,
5571
- ids,
5926
+ model: "ir.ui.menu" /* MENU */,
5927
+ method: "web_search_read" /* WEB_SEARCH_READ */,
5928
+ ids: [],
5929
+ with_context: context,
5572
5930
  kwargs: {
5573
- specification
5931
+ specification,
5932
+ domain: domain ?? [
5933
+ "&",
5934
+ ["is_display", "=", true],
5935
+ "&",
5936
+ ["active", "=", true],
5937
+ ["parent_id", "=", false]
5938
+ ]
5574
5939
  }
5575
5940
  };
5576
- return env?.requests.post(
5941
+ return env?.requests?.post(
5577
5942
  "/call" /* CALL_PATH */,
5578
5943
  jsonData,
5579
5944
  {
5580
5945
  headers: {
5581
- "Content-Type": "application/json",
5582
- ...xNode ? { "X-Node": xNode } : {}
5946
+ "Content-Type": "application/json"
5583
5947
  }
5584
5948
  },
5585
5949
  service
@@ -5587,55 +5951,54 @@ function useViewService() {
5587
5951
  },
5588
5952
  [env]
5589
5953
  );
5590
- const getProductImage = useCallback12(
5591
- ({
5592
- model,
5593
- fields,
5594
- limit,
5595
- offset,
5596
- domain,
5597
- xNode,
5598
- service,
5599
- searchParams
5600
- }) => {
5954
+ const getActionDetail = useCallback40(
5955
+ async (aid, context) => {
5601
5956
  const jsonData = {
5602
- model,
5603
- fields,
5604
- limit,
5605
- offset,
5606
- domain
5607
- };
5608
- const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${toQueryString(searchParams)}` : "/search_read" /* SEARCH_READ */;
5609
- return env?.requests.post(
5610
- url,
5611
- jsonData,
5612
- {
5613
- headers: {
5614
- "Content-Type": "application/json",
5615
- ...xNode ? { "X-Node": xNode } : {}
5957
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
5958
+ method: "web_read" /* WEB_READ */,
5959
+ ids: [aid],
5960
+ with_context: context,
5961
+ kwargs: {
5962
+ specification: {
5963
+ id: {},
5964
+ name: {},
5965
+ res_model: {},
5966
+ views: {},
5967
+ view_mode: {},
5968
+ mobile_view_mode: {},
5969
+ domain: {},
5970
+ context: {},
5971
+ groups_id: {},
5972
+ search_view_id: {}
5616
5973
  }
5617
- },
5618
- service
5619
- );
5974
+ }
5975
+ };
5976
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
5977
+ headers: {
5978
+ "Content-Type": "application/json"
5979
+ }
5980
+ });
5620
5981
  },
5621
5982
  [env]
5622
5983
  );
5623
- const checkPayment = useCallback12(
5624
- ({
5984
+ const getResequence = useCallback40(
5985
+ async ({
5625
5986
  model,
5626
5987
  ids,
5627
- withContext,
5628
- xNode,
5629
- service
5988
+ context,
5989
+ offset,
5990
+ service,
5991
+ xNode
5630
5992
  }) => {
5631
5993
  const jsonData = {
5632
5994
  model,
5633
- method: "check" /* CHECK */,
5995
+ with_context: context,
5634
5996
  ids,
5635
- with_context: withContext
5997
+ field: "sequence",
5998
+ ...offset > 0 ? { offset } : {}
5636
5999
  };
5637
6000
  return env?.requests.post(
5638
- "/call" /* CALL_PATH */,
6001
+ "/web/dataset/resequence",
5639
6002
  jsonData,
5640
6003
  {
5641
6004
  headers: {
@@ -5648,18 +6011,28 @@ function useViewService() {
5648
6011
  },
5649
6012
  [env]
5650
6013
  );
5651
- const handleCloseSession = useCallback12(
5652
- ({
5653
- model,
5654
- ids,
5655
- xNode,
6014
+ const getSelectionItem = useCallback40(
6015
+ async ({
6016
+ data,
5656
6017
  service,
5657
- method
6018
+ xNode
5658
6019
  }) => {
5659
6020
  const jsonData = {
5660
- model,
5661
- ids,
5662
- method
6021
+ model: data.model,
6022
+ ids: [],
6023
+ method: "get_data_select",
6024
+ with_context: data.context,
6025
+ kwargs: {
6026
+ count_limit: 10001,
6027
+ domain: data.domain ? data.domain : [],
6028
+ offset: 0,
6029
+ order: "",
6030
+ specification: data?.specification ?? {
6031
+ id: {},
6032
+ name: {},
6033
+ display_name: {}
6034
+ }
6035
+ }
5663
6036
  };
5664
6037
  return env?.requests.post(
5665
6038
  "/call" /* CALL_PATH */,
@@ -5675,108 +6048,104 @@ function useViewService() {
5675
6048
  },
5676
6049
  [env]
5677
6050
  );
5678
- const handleClosingDetailSession = useCallback12(
5679
- ({
5680
- model,
5681
- ids,
5682
- method,
5683
- xNode,
5684
- service,
5685
- kwargs
6051
+ const loadMessages = useCallback40(async () => {
6052
+ return env.requests.post(
6053
+ "/load_message_failures" /* LOAD_MESSAGE */,
6054
+ {},
6055
+ {
6056
+ headers: {
6057
+ "Content-Type": "application/json"
6058
+ }
6059
+ }
6060
+ );
6061
+ }, [env]);
6062
+ const getVersion = useCallback40(async () => {
6063
+ return env?.requests?.get("", {
6064
+ headers: {
6065
+ "Content-Type": "application/json"
6066
+ }
6067
+ });
6068
+ }, [env]);
6069
+ const grantAccess = useCallback40(
6070
+ async ({
6071
+ redirect_uri,
6072
+ state,
6073
+ client_id,
6074
+ scopes
5686
6075
  }) => {
5687
6076
  const jsonData = {
5688
- model,
5689
- ids,
5690
- method,
5691
- kwargs
6077
+ redirect_uri,
6078
+ state,
6079
+ client_id,
6080
+ scopes
5692
6081
  };
5693
6082
  return env?.requests.post(
5694
- "/call" /* CALL_PATH */,
6083
+ "/grant-access" /* GRANT_ACCESS */,
5695
6084
  jsonData,
5696
6085
  {
5697
6086
  headers: {
5698
- "Content-Type": "application/json",
5699
- ...xNode ? { "X-Node": xNode } : {}
5700
- }
6087
+ "Content-Type": "application/json"
6088
+ },
6089
+ withCredentials: true
5701
6090
  },
5702
- service
6091
+ "id"
5703
6092
  );
5704
6093
  },
5705
6094
  [env]
5706
6095
  );
5707
- const createPosConfig = useCallback12(
5708
- ({
5709
- model,
5710
- name,
5711
- modulePosRestaurant,
5712
- xNode,
5713
- service
5714
- }) => {
6096
+ const removeTotpSetUp = useCallback40(
6097
+ async ({ method, token }) => {
5715
6098
  const jsonData = {
5716
- model,
5717
- values: {
5718
- name,
5719
- module_pos_restaurant: modulePosRestaurant
6099
+ method,
6100
+ with_context: {
6101
+ token
5720
6102
  }
5721
6103
  };
5722
6104
  return env?.requests.post(
5723
- "/create" /* CREATE_PATH */,
6105
+ "/call" /* CALL_PATH */,
5724
6106
  jsonData,
5725
6107
  {
5726
6108
  headers: {
5727
- "Content-Type": "application/json",
5728
- ...xNode ? { "X-Node": xNode } : {}
6109
+ "Content-Type": "application/json"
5729
6110
  }
5730
6111
  },
5731
- service
6112
+ "id"
5732
6113
  );
5733
6114
  },
5734
6115
  [env]
5735
6116
  );
5736
- const searchJournal = useCallback12(
5737
- ({
5738
- model,
5739
- method,
5740
- args,
5741
- kwargs,
5742
- xNode,
5743
- service
5744
- }) => {
6117
+ const requestSetupTotp = useCallback40(
6118
+ async ({ method, token }) => {
5745
6119
  const jsonData = {
5746
- model,
5747
6120
  method,
5748
- args,
5749
- kwargs
6121
+ with_context: { token }
5750
6122
  };
5751
6123
  return env?.requests.post(
5752
6124
  "/call" /* CALL_PATH */,
5753
6125
  jsonData,
5754
6126
  {
5755
6127
  headers: {
5756
- "Content-Type": "application/json",
5757
- ...xNode ? { "X-Node": xNode } : {}
6128
+ "Content-Type": "application/json"
5758
6129
  }
5759
6130
  },
5760
- service
6131
+ "id"
5761
6132
  );
5762
6133
  },
5763
6134
  [env]
5764
6135
  );
5765
- const changeOrderPreparaionState = useCallback12(
5766
- ({
5767
- orderId,
5768
- stageId,
5769
- preparationDisplayId,
5770
- xNode,
5771
- service
6136
+ const settingsWebRead2fa = useCallback40(
6137
+ async ({
6138
+ method,
6139
+ model,
6140
+ kwargs,
6141
+ token
5772
6142
  }) => {
5773
6143
  const jsonData = {
5774
- model: "pos_preparation_display.order" /* POS_PREPARATION_ORDER */,
5775
- method: "change_order_stage" /* CHANGE_ORDER_STAGE */,
5776
- ids: orderId,
5777
- kwargs: {
5778
- stage_id: stageId,
5779
- preparation_display_id: preparationDisplayId
6144
+ method,
6145
+ model,
6146
+ kwargs,
6147
+ with_context: {
6148
+ token
5780
6149
  }
5781
6150
  };
5782
6151
  return env?.requests.post(
@@ -5784,143 +6153,124 @@ function useViewService() {
5784
6153
  jsonData,
5785
6154
  {
5786
6155
  headers: {
5787
- "Content-Type": "application/json",
5788
- ...xNode ? { "X-Node": xNode } : {}
6156
+ "Content-Type": "application/json"
5789
6157
  }
5790
6158
  },
5791
- service
6159
+ "id"
5792
6160
  );
5793
6161
  },
5794
6162
  [env]
5795
6163
  );
5796
- const updateOrderStatus = useCallback12(
5797
- ({
5798
- orderId,
6164
+ const signInSSO = useCallback40(
6165
+ async ({
6166
+ redirect_uri,
5799
6167
  state,
5800
- xNode,
5801
- service
6168
+ client_id,
6169
+ response_type,
6170
+ path,
6171
+ scope
5802
6172
  }) => {
5803
- const jsonData = {
5804
- order_id: orderId,
6173
+ const params = new URLSearchParams({
6174
+ response_type,
6175
+ client_id,
6176
+ redirect_uri,
5805
6177
  state
5806
- };
5807
- return env?.requests.put(
5808
- "/pos-order/status" /* POS_ORDER_STATUS */,
5809
- jsonData,
6178
+ });
6179
+ const queryString = `${params.toString()}&scope=${encodeURIComponent(
6180
+ scope
6181
+ )}`;
6182
+ const url = `${path}?${queryString}`;
6183
+ return env?.requests.get(
6184
+ url,
5810
6185
  {
5811
6186
  headers: {
5812
- "Content-Type": "application/json",
5813
- ...xNode ? { "X-Node": xNode } : {}
5814
- }
6187
+ "Content-Type": "application/json"
6188
+ },
6189
+ withCredentials: true
5815
6190
  },
5816
- service
6191
+ "id"
5817
6192
  );
5818
6193
  },
5819
6194
  [env]
5820
6195
  );
5821
- const processOrder = useCallback12(
6196
+ const verify2FA = useCallback40(
5822
6197
  ({
5823
- orderId,
5824
- xNode,
5825
- service
6198
+ method,
6199
+ with_context,
6200
+ code,
6201
+ device,
6202
+ location
5826
6203
  }) => {
5827
6204
  const jsonData = {
5828
- model: "pos_preparation_display.order" /* POS_PREPARATION_ORDER */,
5829
- method: "process_order" /* PROCESS_ORDER */,
6205
+ method,
5830
6206
  kwargs: {
5831
- order_id: orderId
5832
- }
6207
+ vals: {
6208
+ code,
6209
+ device,
6210
+ location
6211
+ }
6212
+ },
6213
+ with_context
5833
6214
  };
5834
6215
  return env?.requests.post(
5835
6216
  "/call" /* CALL_PATH */,
5836
6217
  jsonData,
5837
6218
  {
5838
6219
  headers: {
5839
- "Content-Type": "application/json",
5840
- ...xNode ? { "X-Node": xNode } : {}
5841
- }
6220
+ "Content-Type": "application/json"
6221
+ },
6222
+ withCredentials: true
5842
6223
  },
5843
- service
6224
+ "id"
5844
6225
  );
5845
6226
  },
5846
6227
  [env]
5847
6228
  );
5848
- const generatePaymentQRInfo = useCallback12(
5849
- ({
5850
- orderId,
5851
- amount,
5852
- posSessionId,
5853
- xNode,
5854
- service
5855
- }) => {
6229
+ const get2FAMethods = useCallback40(
6230
+ ({ method, with_context }) => {
5856
6231
  const jsonData = {
5857
- order_id: orderId,
5858
- amount,
5859
- pos_session_id: posSessionId
6232
+ method,
6233
+ with_context
5860
6234
  };
5861
6235
  return env?.requests.post(
5862
- "/payment/qr" /* PAYMENT_QR */,
6236
+ "/call" /* CALL_PATH */,
5863
6237
  jsonData,
5864
6238
  {
5865
6239
  headers: {
5866
- "Content-Type": "application/json",
5867
- ...xNode ? { "X-Node": xNode } : {}
6240
+ "Content-Type": "application/json"
5868
6241
  }
5869
6242
  },
5870
- service
6243
+ "id"
5871
6244
  );
5872
6245
  },
5873
6246
  [env]
5874
6247
  );
5875
- const savePinCode = useCallback12(
6248
+ const verifyTotp = useCallback40(
5876
6249
  ({
5877
- serialNumber,
5878
- pinCode,
5879
- xNode,
5880
- service
6250
+ method,
6251
+ action_token,
6252
+ code
5881
6253
  }) => {
5882
6254
  const jsonData = {
5883
- serial_number: serialNumber,
5884
- pin_code: pinCode
5885
- };
5886
- return env?.requests.put(
5887
- "/pos_device/pin" /* POS_DEVICE_PIN */,
5888
- jsonData,
5889
- {
5890
- headers: {
5891
- "Content-Type": "application/json",
5892
- ...xNode ? { "X-Node": xNode } : {}
6255
+ method,
6256
+ kwargs: {
6257
+ vals: {
6258
+ code
5893
6259
  }
5894
6260
  },
5895
- service
5896
- );
5897
- },
5898
- [env]
5899
- );
5900
- const getPinCode = useCallback12(
5901
- ({
5902
- serialNumber,
5903
- xNode,
5904
- service
5905
- }) => {
5906
- const jsonData = {
5907
- serial_number: serialNumber
6261
+ with_context: {
6262
+ action_token
6263
+ }
5908
6264
  };
5909
- return env?.requests.post(
5910
- "/pos_device/get_pin_code" /* GET_PIN_CODE */,
5911
- jsonData,
5912
- {
5913
- headers: {
5914
- "Content-Type": "application/json",
5915
- ...xNode ? { "X-Node": xNode } : {}
5916
- }
5917
- },
5918
- service
5919
- );
6265
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
6266
+ headers: {
6267
+ "Content-Type": "application/json"
6268
+ }
6269
+ });
5920
6270
  },
5921
6271
  [env]
5922
6272
  );
5923
- const getNotifications = useCallback12(
6273
+ const getNotifications = useCallback40(
5924
6274
  async ({
5925
6275
  service,
5926
6276
  xNode,
@@ -5940,60 +6290,7 @@ function useViewService() {
5940
6290
  },
5941
6291
  [env]
5942
6292
  );
5943
- const createEInvoice = useCallback12(
5944
- async ({
5945
- service,
5946
- xNode,
5947
- kwargs,
5948
- ids,
5949
- withContext
5950
- }) => {
5951
- const body = {
5952
- model: "pos.order" /* POS_ORDER */,
5953
- method: "create_e_invoice" /* CREATE_E_INVOICE */,
5954
- kwargs,
5955
- ids,
5956
- with_context: withContext
5957
- };
5958
- return env?.requests?.post(
5959
- `${"/call" /* CALL_PATH */}`,
5960
- body,
5961
- {
5962
- headers: {
5963
- "Content-Type": "application/json",
5964
- ...xNode ? { "X-Node": xNode } : {}
5965
- }
5966
- },
5967
- service
5968
- );
5969
- },
5970
- [env]
5971
- );
5972
- const getCurrentUser = useCallback12(
5973
- async ({
5974
- service,
5975
- xNode,
5976
- oauthUid,
5977
- extraHeaders
5978
- }) => {
5979
- return env?.requests?.get(
5980
- `${"/public/user/info" /* PUBLIC_USER_INFO */}/${oauthUid}`,
5981
- {
5982
- headers: extraHeaders ? {
5983
- ...extraHeaders,
5984
- "Content-Type": "application/json",
5985
- ...xNode ? { "X-Node": xNode } : {}
5986
- } : {
5987
- "Content-Type": "application/json",
5988
- ...xNode ? { "X-Node": xNode } : {}
5989
- }
5990
- },
5991
- service
5992
- );
5993
- },
5994
- [env]
5995
- );
5996
- const getCountry = useCallback12(
6293
+ const getCountry = useCallback40(
5997
6294
  async ({
5998
6295
  service,
5999
6296
  xNode,
@@ -6020,7 +6317,7 @@ function useViewService() {
6020
6317
  },
6021
6318
  [env]
6022
6319
  );
6023
- const getCity = useCallback12(
6320
+ const getCity = useCallback40(
6024
6321
  async ({
6025
6322
  service,
6026
6323
  xNode,
@@ -6047,7 +6344,7 @@ function useViewService() {
6047
6344
  },
6048
6345
  [env]
6049
6346
  );
6050
- const getWard = useCallback12(
6347
+ const getWard = useCallback40(
6051
6348
  async ({
6052
6349
  service,
6053
6350
  xNode,
@@ -6072,7 +6369,7 @@ function useViewService() {
6072
6369
  },
6073
6370
  [env]
6074
6371
  );
6075
- const getPartnerTitle = useCallback12(
6372
+ const getPartnerTitle = useCallback40(
6076
6373
  async ({
6077
6374
  service,
6078
6375
  xNode,
@@ -6115,35 +6412,7 @@ function useViewService() {
6115
6412
  verify2FA,
6116
6413
  get2FAMethods,
6117
6414
  verifyTotp,
6118
- getASession,
6119
- updateClosedSession,
6120
- manageSession,
6121
- handleClosingSession,
6122
- createSession,
6123
- getPOS,
6124
- createEntity,
6125
- getList,
6126
- updateEntity,
6127
- deleteEntity,
6128
- loadDataPosSession,
6129
- manageOnChange,
6130
- getOrderLine,
6131
- getProductImage,
6132
- checkPayment,
6133
- handleCloseSession,
6134
- handleClosingDetailSession,
6135
- createPosConfig,
6136
- searchJournal,
6137
- getPreparationDisplayData,
6138
- changeOrderPreparaionState,
6139
- updateOrderStatus,
6140
- processOrder,
6141
- generatePaymentQRInfo,
6142
- savePinCode,
6143
- getPinCode,
6144
6415
  getNotifications,
6145
- createEInvoice,
6146
- getCurrentUser,
6147
6416
  getCountry,
6148
6417
  getCity,
6149
6418
  getWard,
@@ -6152,10 +6421,10 @@ function useViewService() {
6152
6421
  }
6153
6422
 
6154
6423
  // src/services/dashboard-service/index.ts
6155
- import { useCallback as useCallback13 } from "react";
6424
+ import { useCallback as useCallback41 } from "react";
6156
6425
  function useDashboardService() {
6157
6426
  const { env } = useEnv();
6158
- const readGroup = useCallback13(
6427
+ const readGroup = useCallback41(
6159
6428
  async ({
6160
6429
  service,
6161
6430
  xNode,
@@ -6172,7 +6441,7 @@ function useDashboardService() {
6172
6441
  },
6173
6442
  [env]
6174
6443
  );
6175
- const getDataChart = useCallback13(
6444
+ const getDataChart = useCallback41(
6176
6445
  async ({
6177
6446
  service,
6178
6447
  xNode,
@@ -6215,6 +6484,7 @@ export {
6215
6484
  useFormService,
6216
6485
  useKanbanService,
6217
6486
  useModelService,
6487
+ usePosService,
6218
6488
  useUserService,
6219
6489
  useViewService
6220
6490
  };