class TarglogPanel extends ListPanel {
  _enbItmFoot = false; //_enbItmHead=false;

  _lislis(a) {
    let d = a.detail;
    if (d.res) return this.showToast(d.res, "error");
    this.state.list = [];
    let pitm = d.query.slice(0, this.LIM.inc);
    this.setState({
      enbNxt: d.query.length > this.LIM.inc
    });
    for (let i = 0; i < pitm.length; i++) {
      let dat = pitm[i];
      this.addPan(dat);
    }
  }
  nextRow = () => {
    if (!this.state.enbNxt) return;
    this.LIM.curr += this.LIM.inc;
    this.callReqs("listing", {
      curr: this.LIM.curr,
      off: this.LIM.inc + 1
    });
    this.setState({
      enbPrv: true
    });
  };
  prevRow = () => {
    if (!this.state.enbPrv || this.LIM.curr == 0) {
      if (this.LIM.curr == 0) this.setState({
        enbPrv: false
      });
      return;
    }
    this.LIM.curr -= this.LIM.inc;
    this.callReqs("listing", {
      curr: this.LIM.curr,
      off: this.LIM.inc + 1
    });
  };
  get itemHead() {
    return /*#__PURE__*/React.createElement("div", {
      className: 'listItemHead targlogListItemHead'
    }, /*#__PURE__*/React.createElement("span", null, "Target logs"), /*#__PURE__*/React.createElement("span", {
      className: "listItemMenu"
    }, /*#__PURE__*/React.createElement("samp", {
      onClick: () => this.prevRow(),
      disabled: !this.state.enbPrv
    }, /*#__PURE__*/React.createElement("i", {
      className: "fa-solid fa-chevron-left"
    })), /*#__PURE__*/React.createElement("samp", {
      onClick: () => this.nextRow(),
      disabled: !this.state.enbNxt
    }, /*#__PURE__*/React.createElement("i", {
      className: "fa-solid fa-chevron-right"
    }))));
  }
  constructor() {
    super();
    this.LIM.inc = 10;
    this.idName = "targlog";
    this.state.enbNxt = false;
    this.state.enbPrv = true;
    this.itemMids = /*#__PURE__*/React.createElement("div", {
      className: 'listItemMids listItemHead targlogListItemMids'
    }, /*#__PURE__*/React.createElement("span", null, "barcode"), /*#__PURE__*/React.createElement("span", null, "Total"), /*#__PURE__*/React.createElement("span", null, "from"), /*#__PURE__*/React.createElement("span", null, "to"), /*#__PURE__*/React.createElement("span", null, "Time"), /*#__PURE__*/React.createElement("span", null, "note"));
    this.itemMod = Targlog;
  }
  newPan() {
    return;
  }
  componentDidMount() {
    this.updtReqs("listing", "/targs/logs", this._lislis.bind(this));
    this.initReqs();
    this.callReqs("listing", {
      curr: this.LIM.curr,
      off: this.LIM.inc + 1
    });
  }
  componentWillUnmount() {
    this.termReqs();
  }
}
/////////////////////////////////////////////
/////////////////////////////////////////////
//            USERS
/////////////////////////////////////////////
/////////////////////////////////////////////
class Targlog extends ListItem {
  constructor(a) {
    super(a);
    const d = new Date(this.dttim);
    this.dttim = String(d.getUTCDate()).padStart(2, "0") + "/" + String(d.getUTCMonth() + 1).padStart(2, "0") + "/" + d.getUTCFullYear() + " " + String(d.getUTCHours()).padStart(2, "0") + ":" + String(d.getUTCMinutes()).padStart(2, "0") + ":" + String(d.getUTCSeconds()).padStart(2, "0");
  }
  render() {
    return /*#__PURE__*/React.createElement("div", {
      onClick: () => {
        this.setActive(true);
      },
      className: this.parent.itemClass + " listItem" + (this.state.active ? " active " : "")
    }, /*#__PURE__*/React.createElement("span", null, this.pr_bcd), /*#__PURE__*/React.createElement("span", null, this.count), /*#__PURE__*/React.createElement("span", null, this.serid_strt), /*#__PURE__*/React.createElement("span", null, this.serid_end), /*#__PURE__*/React.createElement("span", null, this.dttim), /*#__PURE__*/React.createElement("span", null, this.note));
  }
  componentWillUnmount() {
    this.termReqs();
  }
}