153 lines
4.6 KiB
JavaScript
153 lines
4.6 KiB
JavaScript
import { Card } from "react-native-paper";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import {
|
|
RefreshControl,
|
|
StyleSheet,
|
|
ScrollView,
|
|
Text,
|
|
View,
|
|
} from "react-native";
|
|
import DataLabelComponent from "../data-label/data-label.component";
|
|
|
|
export default function JobTombstone({ job, loading, refetch }) {
|
|
const { t } = useTranslation();
|
|
if (!job) {
|
|
<Card>
|
|
<Text>Job is not defined.</Text>
|
|
</Card>;
|
|
}
|
|
const onRefresh = async () => {
|
|
return refetch();
|
|
};
|
|
|
|
return (
|
|
<ScrollView
|
|
padder
|
|
refreshControl={
|
|
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
|
}
|
|
>
|
|
<Card>
|
|
<Card.Content bordered style={localStyles.status}>
|
|
<Text>{job.status}</Text>
|
|
</Card.Content>
|
|
{job.inproduction && (
|
|
<Card.Content bordered style={localStyles.inproduction}>
|
|
<Text>{t("objects.jobs.labels.inproduction")}</Text>
|
|
</Card.Content>
|
|
)}
|
|
{job.inproduction && job.production_vars && !!job.production_vars.note && (
|
|
<Card.Content bordered style={localStyles.inproduction}>
|
|
<Text>{job.production_vars.note}</Text>
|
|
</Card.Content>
|
|
)}
|
|
</Card>
|
|
<Card>
|
|
<Card.Content bordered style={localStyles.status}>
|
|
<Text>{t("jobdetail.labels.claiminformation")}</Text>
|
|
</Card.Content>
|
|
<View>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.owner")}
|
|
content={`${job.ownr_fn || ""} ${job.ownr_ln || ""} ${
|
|
job.ownr_co_nm || ""
|
|
}`}
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.vehicle")}
|
|
content={`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${
|
|
job.v_model_desc || ""
|
|
}`}
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.ins_co_nm")}
|
|
content={job.ins_co_nm}
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.clm_no")}
|
|
content={job.clm_no}
|
|
/>
|
|
</View>
|
|
</Card>
|
|
<Card>
|
|
<Card.Content bordered style={localStyles.status}>
|
|
<Text>{t("jobdetail.labels.employeeassignments")}</Text>
|
|
</Card.Content>
|
|
<View>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.employee_body")}
|
|
content={`${
|
|
(job.employee_body_rel && job.employee_body_rel.first_name) || ""
|
|
} ${
|
|
(job.employee_body_rel && job.employee_body_rel.last_name) || ""
|
|
}`}
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.employee_prep")}
|
|
content={`${
|
|
(job.employee_prep_rel && job.employee_prep_rel.first_name) || ""
|
|
} ${
|
|
(job.employee_prep_rel && job.employee_prep_rel.last_name) || ""
|
|
}`}
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.employee_refinish")}
|
|
content={`${
|
|
(job.employee_refinish_rel &&
|
|
job.employee_refinish_rel.first_name) ||
|
|
""
|
|
} ${
|
|
(job.employee_refinish_rel &&
|
|
job.employee_refinish_rel.last_name) ||
|
|
""
|
|
}`}
|
|
/>
|
|
</View>
|
|
</Card>
|
|
<Card style={localStyles.twoColumnCard}>
|
|
<View style={localStyles.twoColumnCardColumn}>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.scheduled_in")}
|
|
content={job.scheduled_in}
|
|
dateTime
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.actual_in")}
|
|
content={job.actual_in}
|
|
dateTime
|
|
/>
|
|
</View>
|
|
<View style={localStyles.twoColumnCardColumn}>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.scheduled_completion")}
|
|
content={job.scheduled_completion}
|
|
dateTime
|
|
/>
|
|
<DataLabelComponent
|
|
label={t("objects.jobs.fields.scheduled_delivery")}
|
|
content={job.scheduled_delivery}
|
|
dateTime
|
|
/>
|
|
</View>
|
|
</Card>
|
|
</ScrollView>
|
|
);
|
|
}
|
|
|
|
const localStyles = StyleSheet.create({
|
|
twoColumnCard: { display: "flex", flexDirection: "row" },
|
|
twoColumnCardColumn: { flex: 1 },
|
|
status: {
|
|
textAlign: "center",
|
|
flexDirection: "row",
|
|
justifyContent: "center",
|
|
},
|
|
inproduction: {
|
|
backgroundColor: "tomato",
|
|
textAlign: "center",
|
|
flexDirection: "row",
|
|
justifyContent: "center",
|
|
},
|
|
});
|