"use strict";
const common_vendor = require("../../../common/vendor.js");
require("../../../common/libraries/request.js");
require("../../../common/store/useWatermarkStore.js");
const common_store_useWeAppAuthStore = require("../../../common/store/useWeAppAuthStore.js");
require("../../../common/store/useWorkStore.js");
const common_libraries_apiLoading = require("../../../common/libraries/apiLoading.js");
const gen_Apis = require("../../../gen/Apis.js");
const ME_attendance_my_schedules_model = require("./model.js");
common_store_useWeAppAuthStore.useWeAppAuthStore();
const getList = () => {
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Attendance.AttendanceSchedules.GetAttendanceSchedules, {}).then((res) => {
    ME_attendance_my_schedules_model.useModel.showData.value = (res == null ? void 0 : res.data) || void 0;
  });
};
const method = {
  getList,
  loadMore(res) {
    ME_attendance_my_schedules_model.useModel.formData.value.page = res == null ? void 0 : res.page;
    getList();
  },
  async uploadMedia(data) {
    let res = await gen_Apis.Apis.Customer.CustomerMoments.UploadMedia(data);
    return res == null ? void 0 : res.data;
  },
  calculationCurrent(res) {
    var _a, _b, _c, _d, _e, _f;
    if (((_b = (_a = res == null ? void 0 : res.checkin_status) == null ? void 0 : _a.start) == null ? void 0 : _b.checked) && ((_d = (_c = res == null ? void 0 : res.checkin_status) == null ? void 0 : _c.end) == null ? void 0 : _d.checked)) {
      return 3;
    }
    if ((_f = (_e = res == null ? void 0 : res.checkin_status) == null ? void 0 : _e.start) == null ? void 0 : _f.checked) {
      return 1;
    }
    return null;
  },
  toDetaile(res) {
    var _a, _b, _c, _d, _e, _f;
    common_vendor.index.navigateTo({
      url: `/ME/attendance/sign_clock_in/index?attendance_schedules_id=${(_c = (_b = (_a = ME_attendance_my_schedules_model.useModel) == null ? void 0 : _a.showData) == null ? void 0 : _b.value) == null ? void 0 : _c.schedule_id}&attendance_shift_periods_id=${res == null ? void 0 : res.id}&checkin_type=${res == null ? void 0 : res.type}&date=${(_f = (_e = (_d = ME_attendance_my_schedules_model.useModel) == null ? void 0 : _d.showData) == null ? void 0 : _e.value) == null ? void 0 : _f.schedule_date}`
    });
  }
};
exports.method = method;
