Skip to content

Commit

Permalink
feat(compensations): per-location salaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 3, 2024
1 parent ce467ca commit 93789dd
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions studio/schemas/documents/compensations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import seo from "../objects/seo";
import { title } from "../fields/text";
import { benefitId } from "./benefit";
import MultiLineDescription from "../../components/MultiLineDescription";
import { locationId } from "./location";
import { SalariesInput } from "../../components/SalaryCsvInput/SalariesInput";

export const compensationsId = "compensations";

Expand All @@ -28,6 +30,74 @@ const compensations = defineType({
type: "boolean",
initialValue: true,
}),
defineField({
name: "salaries",
title: "Salaries",
description: "Per-location salaries",
type: "array",
of: [
{
title: "Location Salaries",
description: "Yearly salary data for a specific location",
type: "object",
fields: [
defineField({
name: "location",
title: "Location",
type: "reference",
to: [{ type: locationId }],
}),
defineField({
name: "yearlySalaries",
title: "Yearly Salaries",
description: "Salary tiers for each year",
type: "array",
options: {
sortable: false,
},
of: [
{
type: "object",
fields: [
defineField({
name: "year",
title: "Year",
type: "number",
validation: (Rule) => Rule.required().min(2018),
}),
defineField({
name: "salaries",
title: "Salaries",
type: "string",
components: {
input: SalariesInput,
},
}),
],
preview: {
select: {
title: "year",
salaries: "salaries",
},
},
},
],
}),
],
preview: {
select: {
location: "location.basicTitle",
},
prepare({ location }) {
return {
title: location,
subtitle: "Location Salaries",
};
},
},
},
],
}),
defineField({
name: "benefits",
title: "Benefits",
Expand Down

0 comments on commit 93789dd

Please sign in to comment.