UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

46 lines 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const abstract_field_1 = require("./abstract-field"); const cosmoui_1 = require("cosmoui"); const ts_utils_1 = require("@lml/ts-utils"); const cx = require("classnames"); const selectors_1 = require("../../../../jobs/selectors"); const constants_1 = require("../../../../jobs/constants"); const styles = require('./job-fields.scss'); class CollectByField extends abstract_field_1.AbstractJobField { render() { const { job } = this.props; const pickup = selectors_1.timeToPickup(job); const classes = cx(styles.timeField, pickup < 0 ? styles.timeNegativeField : styles.timePositiveField); return (React.createElement(cosmoui_1.Column, { className: classes }, ts_utils_1.formatMinutes(pickup))); } } exports.CollectByField = CollectByField; class DeliverByField extends abstract_field_1.AbstractJobField { render() { const { job } = this.props; const complete = selectors_1.timeToComplete(job); return (React.createElement(cosmoui_1.Column, { className: styles.timeField }, ts_utils_1.formatMinutes(complete))); } } exports.DeliverByField = DeliverByField; /** * NOTE: there is no completedAt field * to get the completed at time you must got to the JobStatusModel * and check that the status is completed. If so then then the completed time * will be availble form the timestamp field */ class CompletedAtField extends abstract_field_1.AbstractJobField { render() { const { jobByStatus } = this.props; if (jobByStatus.status !== constants_1.JOB_STATUS.COMPLETED) { throw new Error(`Cannot access the completed time for job with status ${jobByStatus.status}`); } return (React.createElement(cosmoui_1.Column, { className: styles.timeField }, ts_utils_1.formatTime(jobByStatus.timestamp))); } } exports.CompletedAtField = CompletedAtField; //# sourceMappingURL=time-field.js.map