Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLA-1756] add claim conditions view #105

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/js/api/beam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class BeamApi {
start: updateBeamData.start,
end: updateBeamData.end,
flags: updateBeamData.flags,
claimConditions: updateBeamData.claimConditions,
},
};

Expand Down
17 changes: 17 additions & 0 deletions resources/js/components/slideovers/beam/DetailsBeamSlideover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
<dt class="text-base font-medium text-gray-500">Flags</dt>
<Chip v-for="flag in item.flags" :key="flag" :text="flag" :closable="false" class="mr-2" />
</div>
<div class="space-y-2 pt-4 pb-3" v-if="item.claimConditions.length">
<dt class="text-base font-medium text-gray-500">Conditions</dt>
<Chip
v-for="condition in item.claimConditions"
:key="condition.type"
:text="formatCondition(condition)"
:closable="false"
class="mr-2"
/>
</div>
</div>
</div>
</div>
Expand All @@ -77,6 +87,13 @@ defineProps<{
isClaimable: boolean;
flags: string[];
image: string;
claimConditions: { type: string; value: string }[];
};
}>();

const formatCondition = (condition) => {
const type = condition.type.replace(/_/g, ' ');

return `${type}: ${condition.value}`;
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const props = withDefaults(
start: string;
end: string;
flags: string[];
claimConditions: { type: string; value: string }[];
};
}>(),
{
Expand Down Expand Up @@ -151,6 +152,7 @@ const checkChanges = () => {
};
})
: null,
claimConditions: props.item?.claimConditions,
};
};

Expand Down
3 changes: 2 additions & 1 deletion resources/js/graphql/mutation/beam/UpdateBeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default `mutation UpdateBeam($code: String!, $name: String, $description: String, $image: String, $start: DateTime, $end: DateTime, $flags: [BeamFlagInputType!]) {
export default `mutation UpdateBeam($code: String!, $name: String, $description: String, $image: String, $start: DateTime, $end: DateTime, $flags: [BeamFlagInputType!], $claimConditions: [ClaimConditionInputType]) {
UpdateBeam(
code: $code
name: $name
Expand All @@ -7,5 +7,6 @@ export default `mutation UpdateBeam($code: String!, $name: String, $description:
start: $start
end: $end
flags: $flags
claimConditions: $claimConditions
)
}`;
4 changes: 4 additions & 0 deletions resources/js/graphql/query/beam/GetBeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ export default `query GetBeam($code: String!, $account: String) {
url
payload
}
claimConditions {
type
value
}
}
}`;
4 changes: 4 additions & 0 deletions resources/js/graphql/query/beam/GetBeams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default `query GetBeams($codes: [String!], $names: [String!], $after: Str
url
payload
}
claimConditions {
type
value
}
}
}
pageInfo {
Expand Down
Loading