Add vendor services

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-18 18:26:17 +02:00
parent 0262bd1c3d
commit 54c14a1816
25 changed files with 4638 additions and 68 deletions

View File

@@ -117,6 +117,11 @@ export default function VendorDetailPage(props: Props) {
>
{__("Contacts")}
</TabLink>
<TabLink
to={`/organizations/${organizationId}/vendors/${vendor.id}/services`}
>
{__("Services")}
</TabLink>
</Tabs>
<Outlet context={{ vendor, peopleId: data.viewer.user.people!.id }} />

View File

@@ -0,0 +1,123 @@
import { useTranslate } from "@probo/i18n";
import {
Breadcrumb,
Button,
Dialog,
DialogContent,
DialogFooter,
Field,
useDialogRef,
} from "@probo/ui";
import { cleanFormData } from "@probo/helpers";
import { type ReactNode } from "react";
import { graphql } from "relay-runtime";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import { z } from "zod";
import { useFormWithSchema } from "/hooks/useFormWithSchema";
type Props = {
children: ReactNode;
connectionId: string;
vendorId: string;
};
const createServiceMutation = graphql`
mutation CreateServiceDialogMutation(
$input: CreateVendorServiceInput!
$connections: [ID!]!
) {
createVendorService(input: $input) {
vendorServiceEdge @prependEdge(connections: $connections) {
node {
...VendorServicesTabFragment_service
}
}
}
}
`;
export function CreateServiceDialog({
children,
connectionId,
vendorId,
}: Props) {
const { __ } = useTranslate();
const schema = z.object({
name: z.string().min(1, __("Service name is required")),
description: z.string().optional(),
});
const { register, handleSubmit, formState, reset } = useFormWithSchema(
schema,
{
defaultValues: {
name: "",
description: "",
},
}
);
const [createService, isLoading] = useMutationWithToasts(
createServiceMutation,
{
successMessage: __("Service created successfully."),
errorMessage: __("Failed to create service. Please try again."),
}
);
const onSubmit = handleSubmit((data) => {
const cleanData = cleanFormData(data);
createService({
variables: {
input: {
vendorId,
...cleanData,
},
connections: [connectionId],
},
onSuccess: () => {
dialogRef.current?.close();
reset();
},
});
});
const dialogRef = useDialogRef();
return (
<Dialog
className="max-w-lg"
ref={dialogRef}
trigger={children}
title={
<Breadcrumb items={[__("Services"), __("New Service")]} />
}
>
<form onSubmit={onSubmit}>
<DialogContent padded className="space-y-4">
<Field
label={__("Name")}
{...register("name")}
type="text"
error={formState.errors.name?.message}
placeholder={__("Service name")}
required
/>
<Field
label={__("Description")}
{...register("description")}
type="textarea"
error={formState.errors.description?.message}
placeholder={__("Brief description of the service")}
/>
</DialogContent>
<DialogFooter>
<Button type="submit" disabled={isLoading}>
{__("Create")}
</Button>
</DialogFooter>
</form>
</Dialog>
);
}

View File

@@ -0,0 +1,120 @@
import { useTranslate } from "@probo/i18n";
import {
Breadcrumb,
Button,
Dialog,
DialogContent,
DialogFooter,
Field,
useDialogRef,
} from "@probo/ui";
import { cleanFormData } from "@probo/helpers";
import { useEffect } from "react";
import { graphql } from "relay-runtime";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import { z } from "zod";
import { useFormWithSchema } from "/hooks/useFormWithSchema";
type Props = {
serviceId: string;
service: {
name: string;
description?: string | null;
};
onClose: () => void;
};
const updateServiceMutation = graphql`
mutation EditServiceDialogUpdateMutation($input: UpdateVendorServiceInput!) {
updateVendorService(input: $input) {
vendorService {
...VendorServicesTabFragment_service
}
}
}
`;
export function EditServiceDialog({ serviceId, service, onClose }: Props) {
const { __ } = useTranslate();
const schema = z.object({
name: z.string().min(1, __("Service name is required")),
description: z.string().optional(),
});
const { register, handleSubmit, formState } = useFormWithSchema(
schema,
{
defaultValues: {
name: service.name || "",
description: service.description || "",
},
}
);
const [updateService, isLoading] = useMutationWithToasts(
updateServiceMutation,
{
successMessage: __("Service updated successfully."),
errorMessage: __("Failed to update service. Please try again."),
}
);
const onSubmit = handleSubmit((data) => {
const cleanData = cleanFormData(data);
updateService({
variables: {
input: {
id: serviceId,
...cleanData,
},
},
onSuccess: () => {
onClose();
},
});
});
const dialogRef = useDialogRef();
useEffect(() => {
dialogRef.current?.open();
}, []);
return (
<Dialog
className="max-w-lg"
ref={dialogRef}
onClose={onClose}
title={
<Breadcrumb items={[__("Services"), __("Edit Service")]} />
}
>
<form onSubmit={onSubmit}>
<DialogContent padded className="space-y-4">
<Field
label={__("Name")}
{...register("name")}
type="text"
error={formState.errors.name?.message}
placeholder={__("Service name")}
required
/>
<Field
label={__("Description")}
{...register("description")}
type="textarea"
error={formState.errors.description?.message}
placeholder={__("Brief description of the service")}
/>
</DialogContent>
<DialogFooter>
<Button type="submit" disabled={isLoading}>
{__("Save")}
</Button>
</DialogFooter>
</form>
</Dialog>
);
}

View File

@@ -0,0 +1,216 @@
/**
* @generated SignedSource<<57cf7bb390b9d8d00ce0368cf782205c>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type CreateVendorServiceInput = {
description?: string | null | undefined;
name: string;
type?: string | null | undefined;
url?: string | null | undefined;
vendorId: string;
};
export type CreateServiceDialogMutation$variables = {
connections: ReadonlyArray<string>;
input: CreateVendorServiceInput;
};
export type CreateServiceDialogMutation$data = {
readonly createVendorService: {
readonly vendorServiceEdge: {
readonly node: {
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment_service">;
};
};
};
};
export type CreateServiceDialogMutation = {
response: CreateServiceDialogMutation$data;
variables: CreateServiceDialogMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "connections"
},
v1 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
},
v2 = [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
];
return {
"fragment": {
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "CreateServiceDialogMutation",
"selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "CreateVendorServicePayload",
"kind": "LinkedField",
"name": "createVendorService",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorServiceEdge",
"kind": "LinkedField",
"name": "vendorServiceEdge",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"args": null,
"kind": "FragmentSpread",
"name": "VendorServicesTabFragment_service"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [
(v1/*: any*/),
(v0/*: any*/)
],
"kind": "Operation",
"name": "CreateServiceDialogMutation",
"selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "CreateVendorServicePayload",
"kind": "LinkedField",
"name": "createVendorService",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorServiceEdge",
"kind": "LinkedField",
"name": "vendorServiceEdge",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"filters": null,
"handle": "prependEdge",
"key": "",
"kind": "LinkedHandle",
"name": "vendorServiceEdge",
"handleArgs": [
{
"kind": "Variable",
"name": "connections",
"variableName": "connections"
}
]
}
],
"storageKey": null
}
]
},
"params": {
"cacheID": "c4c687377eb1a18eb15abbfa1bf86bfa",
"id": null,
"metadata": {},
"name": "CreateServiceDialogMutation",
"operationKind": "mutation",
"text": "mutation CreateServiceDialogMutation(\n $input: CreateVendorServiceInput!\n) {\n createVendorService(input: $input) {\n vendorServiceEdge {\n node {\n ...VendorServicesTabFragment_service\n id\n }\n }\n }\n}\n\nfragment VendorServicesTabFragment_service on VendorService {\n id\n name\n description\n createdAt\n updatedAt\n}\n"
}
};
})();
(node as any).hash = "8dd0e535bfa15e8ac78b630139b57177";
export default node;

View File

@@ -0,0 +1,166 @@
/**
* @generated SignedSource<<97f0c6ed319e3fba440079ef085a55eb>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type UpdateVendorServiceInput = {
description?: string | null | undefined;
id: string;
name?: string | null | undefined;
type?: string | null | undefined;
url?: string | null | undefined;
};
export type EditServiceDialogUpdateMutation$variables = {
input: UpdateVendorServiceInput;
};
export type EditServiceDialogUpdateMutation$data = {
readonly updateVendorService: {
readonly vendorService: {
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment_service">;
};
};
};
export type EditServiceDialogUpdateMutation = {
response: EditServiceDialogUpdateMutation$data;
variables: EditServiceDialogUpdateMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
}
],
v1 = [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "EditServiceDialogUpdateMutation",
"selections": [
{
"alias": null,
"args": (v1/*: any*/),
"concreteType": "UpdateVendorServicePayload",
"kind": "LinkedField",
"name": "updateVendorService",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "vendorService",
"plural": false,
"selections": [
{
"args": null,
"kind": "FragmentSpread",
"name": "VendorServicesTabFragment_service"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "EditServiceDialogUpdateMutation",
"selections": [
{
"alias": null,
"args": (v1/*: any*/),
"concreteType": "UpdateVendorServicePayload",
"kind": "LinkedField",
"name": "updateVendorService",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "vendorService",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
]
},
"params": {
"cacheID": "f2c37fa9a0b7f0ed043a4529d1f50c65",
"id": null,
"metadata": {},
"name": "EditServiceDialogUpdateMutation",
"operationKind": "mutation",
"text": "mutation EditServiceDialogUpdateMutation(\n $input: UpdateVendorServiceInput!\n) {\n updateVendorService(input: $input) {\n vendorService {\n ...VendorServicesTabFragment_service\n id\n }\n }\n}\n\nfragment VendorServicesTabFragment_service on VendorService {\n id\n name\n description\n createdAt\n updatedAt\n}\n"
}
};
})();
(node as any).hash = "8a34720f5ae7e1f5c619518d4e0db460";
export default node;

View File

@@ -120,7 +120,6 @@ export default function VendorContactsTab() {
<SortableTh field="EMAIL">{__("Email")}</SortableTh>
<Th>{__("Phone")}</Th>
<Th>{__("Role")}</Th>
<SortableTh field="CREATED_AT">{__("Created")}</SortableTh>
<Th>{__("Actions")}</Th>
</Tr>
</Thead>
@@ -165,7 +164,6 @@ function ContactRow(props: ContactRowProps) {
contactFragment,
props.contactKey
);
const { dateFormat } = useTranslate();
const confirm = useConfirm();
const [deleteContact] = useMutationWithToasts(deleteContactMutation, {
successMessage: __("Contact deleted successfully"),
@@ -222,7 +220,6 @@ function ContactRow(props: ContactRowProps) {
)}
</Td>
<Td>{contact.role || __("—")}</Td>
<Td>{dateFormat(contact.createdAt)}</Td>
<Td width={50} className="text-end">
<ActionDropdown>
<DropdownItem

View File

@@ -0,0 +1,214 @@
import { useOutletContext } from "react-router";
import { graphql } from "relay-runtime";
import type { VendorServicesTabFragment$key } from "./__generated__/VendorServicesTabFragment.graphql";
import { useTranslate } from "@probo/i18n";
import { usePageTitle } from "@probo/hooks";
import {
ActionDropdown,
Button,
DropdownItem,
IconPlusLarge,
IconTrashCan,
IconPencil,
PageHeader,
Tbody,
Td,
Th,
Thead,
Tr,
useConfirm,
} from "@probo/ui";
import { useFragment, useRefetchableFragment } from "react-relay";
import type { VendorServicesTabFragment_service$key } from "./__generated__/VendorServicesTabFragment_service.graphql";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import { sprintf } from "@probo/helpers";
import { SortableTable, SortableTh } from "/components/SortableTable";
import { CreateServiceDialog } from "../dialogs/CreateServiceDialog";
import { EditServiceDialog } from "../dialogs/EditServiceDialog";
import { useState } from "react";
export const vendorServicesFragment = graphql`
fragment VendorServicesTabFragment on Vendor
@refetchable(queryName: "VendorServicesListQuery")
@argumentDefinitions(
first: { type: "Int", defaultValue: 50 }
order: { type: "VendorServiceOrder", defaultValue: null }
after: { type: "CursorKey", defaultValue: null }
before: { type: "CursorKey", defaultValue: null }
last: { type: "Int", defaultValue: null }
) {
services(
first: $first
after: $after
last: $last
before: $before
orderBy: $order
) @connection(key: "VendorServicesTabFragment_services") {
__id
edges {
node {
id
...VendorServicesTabFragment_service
}
}
}
}
`;
const serviceFragment = graphql`
fragment VendorServicesTabFragment_service on VendorService {
id
name
description
createdAt
updatedAt
}
`;
const deleteServiceMutation = graphql`
mutation VendorServicesTabDeleteServiceMutation(
$input: DeleteVendorServiceInput!
$connections: [ID!]!
) {
deleteVendorService(input: $input) {
deletedVendorServiceId @deleteEdge(connections: $connections)
}
}
`;
export default function VendorServicesTab() {
const { vendor } = useOutletContext<{
vendor: VendorServicesTabFragment$key & { name: string; id: string };
}>();
const [data, refetch] = useRefetchableFragment(
vendorServicesFragment,
vendor
);
const connectionId = data.services.__id;
const services = data.services.edges.map((edge) => edge.node);
const { __ } = useTranslate();
const [editingService, setEditingService] = useState<{
id: string;
name: string;
description?: string | null;
} | null>(null);
usePageTitle(vendor.name + " - " + __("Services"));
return (
<div className="space-y-6">
<PageHeader
title={__("Services")}
description={__("Manage services provided by this vendor.")}
>
<CreateServiceDialog
vendorId={vendor.id}
connectionId={connectionId}
>
<Button icon={IconPlusLarge}>{__("Add service")}</Button>
</CreateServiceDialog>
</PageHeader>
<SortableTable refetch={refetch}>
<Thead>
<Tr>
<SortableTh field="NAME">{__("Name")}</SortableTh>
<Th>{__("Description")}</Th>
<Th>{__("Actions")}</Th>
</Tr>
</Thead>
<Tbody>
{services.map((service) => (
<ServiceRow
key={service.id}
serviceKey={service}
connectionId={connectionId}
onEdit={setEditingService}
/>
))}
</Tbody>
</SortableTable>
{editingService && (
<EditServiceDialog
serviceId={editingService.id}
service={editingService}
onClose={() => setEditingService(null)}
/>
)}
</div>
);
}
type ServiceRowProps = {
serviceKey: VendorServicesTabFragment_service$key;
connectionId: string;
onEdit: (service: {
id: string;
name: string;
description?: string | null;
}) => void;
};
function ServiceRow(props: ServiceRowProps) {
const { __ } = useTranslate();
const service = useFragment<VendorServicesTabFragment_service$key>(
serviceFragment,
props.serviceKey
);
const confirm = useConfirm();
const [deleteService] = useMutationWithToasts(deleteServiceMutation, {
successMessage: __("Service deleted successfully"),
errorMessage: __("Failed to delete service"),
});
const handleDelete = () => {
confirm(
() =>
deleteService({
variables: {
connections: [props.connectionId],
input: {
vendorServiceId: service.id,
},
},
}),
{
message: sprintf(
__(
'This will permanently delete the service "%s". This action cannot be undone.'
),
service.name
),
}
);
};
return (
<Tr>
<Td>{service.name}</Td>
<Td>{service.description || __("—")}</Td>
<Td width={50} className="text-end">
<ActionDropdown>
<DropdownItem
icon={IconPencil}
onClick={() => props.onEdit({
id: service.id,
name: service.name,
description: service.description,
})}
>
{__("Edit")}
</DropdownItem>
<DropdownItem
icon={IconTrashCan}
onClick={handleDelete}
variant="danger"
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
</Td>
</Tr>
);
}

View File

@@ -0,0 +1,344 @@
/**
* @generated SignedSource<<e3bc26d270857dd70a2fb548de99d86f>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type OrderDirection = "ASC" | "DESC";
export type VendorServiceOrderField = "CREATED_AT" | "NAME";
export type VendorServiceOrder = {
direction: OrderDirection;
field: VendorServiceOrderField;
};
export type VendorServicesListQuery$variables = {
after?: any | null | undefined;
before?: any | null | undefined;
first?: number | null | undefined;
id: string;
last?: number | null | undefined;
order?: VendorServiceOrder | null | undefined;
};
export type VendorServicesListQuery$data = {
readonly node: {
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment">;
};
};
export type VendorServicesListQuery = {
response: VendorServicesListQuery$data;
variables: VendorServicesListQuery$variables;
};
const node: ConcreteRequest = (function(){
var v0 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "after"
},
v1 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "before"
},
v2 = {
"defaultValue": 50,
"kind": "LocalArgument",
"name": "first"
},
v3 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "id"
},
v4 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "last"
},
v5 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "order"
},
v6 = [
{
"kind": "Variable",
"name": "id",
"variableName": "id"
}
],
v7 = {
"kind": "Variable",
"name": "after",
"variableName": "after"
},
v8 = {
"kind": "Variable",
"name": "before",
"variableName": "before"
},
v9 = {
"kind": "Variable",
"name": "first",
"variableName": "first"
},
v10 = {
"kind": "Variable",
"name": "last",
"variableName": "last"
},
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v13 = [
(v7/*: any*/),
(v8/*: any*/),
(v9/*: any*/),
(v10/*: any*/),
{
"kind": "Variable",
"name": "orderBy",
"variableName": "order"
}
];
return {
"fragment": {
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v2/*: any*/),
(v3/*: any*/),
(v4/*: any*/),
(v5/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "VendorServicesListQuery",
"selections": [
{
"alias": null,
"args": (v6/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"args": [
(v7/*: any*/),
(v8/*: any*/),
(v9/*: any*/),
(v10/*: any*/),
{
"kind": "Variable",
"name": "order",
"variableName": "order"
}
],
"kind": "FragmentSpread",
"name": "VendorServicesTabFragment"
}
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v2/*: any*/),
(v4/*: any*/),
(v5/*: any*/),
(v3/*: any*/)
],
"kind": "Operation",
"name": "VendorServicesListQuery",
"selections": [
{
"alias": null,
"args": (v6/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v11/*: any*/),
(v12/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v13/*: any*/),
"concreteType": "VendorServiceConnection",
"kind": "LinkedField",
"name": "services",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorServiceEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v12/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
},
(v11/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasPreviousPage",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "startCursor",
"storageKey": null
}
],
"storageKey": null
},
{
"kind": "ClientExtension",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__id",
"storageKey": null
}
]
}
],
"storageKey": null
},
{
"alias": null,
"args": (v13/*: any*/),
"filters": [
"orderBy"
],
"handle": "connection",
"key": "VendorServicesTabFragment_services",
"kind": "LinkedHandle",
"name": "services"
}
],
"type": "Vendor",
"abstractKey": null
}
],
"storageKey": null
}
]
},
"params": {
"cacheID": "102f3aac3e2c7ef5115d73246f1bb241",
"id": null,
"metadata": {},
"name": "VendorServicesListQuery",
"operationKind": "query",
"text": "query VendorServicesListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: VendorServiceOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...VendorServicesTabFragment_16fISc\n id\n }\n}\n\nfragment VendorServicesTabFragment_16fISc on Vendor {\n services(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n ...VendorServicesTabFragment_service\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment VendorServicesTabFragment_service on VendorService {\n id\n name\n description\n createdAt\n updatedAt\n}\n"
}
};
})();
(node as any).hash = "fd0c58f2929f925fb47e5df22f6a84f7";
export default node;

View File

@@ -0,0 +1,132 @@
/**
* @generated SignedSource<<deb85307c2d7da7ec52f99a67ad56d9f>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DeleteVendorServiceInput = {
vendorServiceId: string;
};
export type VendorServicesTabDeleteServiceMutation$variables = {
connections: ReadonlyArray<string>;
input: DeleteVendorServiceInput;
};
export type VendorServicesTabDeleteServiceMutation$data = {
readonly deleteVendorService: {
readonly deletedVendorServiceId: string;
};
};
export type VendorServicesTabDeleteServiceMutation = {
response: VendorServicesTabDeleteServiceMutation$data;
variables: VendorServicesTabDeleteServiceMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "connections"
},
v1 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
},
v2 = [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
],
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "deletedVendorServiceId",
"storageKey": null
};
return {
"fragment": {
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "VendorServicesTabDeleteServiceMutation",
"selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "DeleteVendorServicePayload",
"kind": "LinkedField",
"name": "deleteVendorService",
"plural": false,
"selections": [
(v3/*: any*/)
],
"storageKey": null
}
],
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [
(v1/*: any*/),
(v0/*: any*/)
],
"kind": "Operation",
"name": "VendorServicesTabDeleteServiceMutation",
"selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "DeleteVendorServicePayload",
"kind": "LinkedField",
"name": "deleteVendorService",
"plural": false,
"selections": [
(v3/*: any*/),
{
"alias": null,
"args": null,
"filters": null,
"handle": "deleteEdge",
"key": "",
"kind": "ScalarHandle",
"name": "deletedVendorServiceId",
"handleArgs": [
{
"kind": "Variable",
"name": "connections",
"variableName": "connections"
}
]
}
],
"storageKey": null
}
]
},
"params": {
"cacheID": "fef00196f74b15a5528a0974541f1ec4",
"id": null,
"metadata": {},
"name": "VendorServicesTabDeleteServiceMutation",
"operationKind": "mutation",
"text": "mutation VendorServicesTabDeleteServiceMutation(\n $input: DeleteVendorServiceInput!\n) {\n deleteVendorService(input: $input) {\n deletedVendorServiceId\n }\n}\n"
}
};
})();
(node as any).hash = "73d14c22b95d031b2c07b18dbbeb64d4";
export default node;

View File

@@ -0,0 +1,225 @@
/**
* @generated SignedSource<<4dfc017ac50d12a09ddac0cf37061c06>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type VendorServicesTabFragment$data = {
readonly id: string;
readonly services: {
readonly __id: string;
readonly edges: ReadonlyArray<{
readonly node: {
readonly id: string;
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment_service">;
};
}>;
};
readonly " $fragmentType": "VendorServicesTabFragment";
};
export type VendorServicesTabFragment$key = {
readonly " $data"?: VendorServicesTabFragment$data;
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment">;
};
import VendorServicesListQuery_graphql from './VendorServicesListQuery.graphql';
const node: ReaderFragment = (function(){
var v0 = [
"services"
],
v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
};
return {
"argumentDefinitions": [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "after"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "before"
},
{
"defaultValue": 50,
"kind": "LocalArgument",
"name": "first"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "last"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "order"
}
],
"kind": "Fragment",
"metadata": {
"connection": [
{
"count": null,
"cursor": null,
"direction": "bidirectional",
"path": (v0/*: any*/)
}
],
"refetch": {
"connection": {
"forward": {
"count": "first",
"cursor": "after"
},
"backward": {
"count": "last",
"cursor": "before"
},
"path": (v0/*: any*/)
},
"fragmentPathInResult": [
"node"
],
"operation": VendorServicesListQuery_graphql,
"identifierInfo": {
"identifierField": "id",
"identifierQueryVariableName": "id"
}
}
},
"name": "VendorServicesTabFragment",
"selections": [
{
"alias": "services",
"args": [
{
"kind": "Variable",
"name": "orderBy",
"variableName": "order"
}
],
"concreteType": "VendorServiceConnection",
"kind": "LinkedField",
"name": "__VendorServicesTabFragment_services_connection",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorServiceEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "VendorService",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v1/*: any*/),
{
"args": null,
"kind": "FragmentSpread",
"name": "VendorServicesTabFragment_service"
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasPreviousPage",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "startCursor",
"storageKey": null
}
],
"storageKey": null
},
{
"kind": "ClientExtension",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__id",
"storageKey": null
}
]
}
],
"storageKey": null
},
(v1/*: any*/)
],
"type": "Vendor",
"abstractKey": null
};
})();
(node as any).hash = "fd0c58f2929f925fb47e5df22f6a84f7";
export default node;

View File

@@ -0,0 +1,74 @@
/**
* @generated SignedSource<<2f6dc5bf85b9ad81fe6c9af7955e4217>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type VendorServicesTabFragment_service$data = {
readonly createdAt: any;
readonly description: string | null | undefined;
readonly id: string;
readonly name: string;
readonly updatedAt: any;
readonly " $fragmentType": "VendorServicesTabFragment_service";
};
export type VendorServicesTabFragment_service$key = {
readonly " $data"?: VendorServicesTabFragment_service$data;
readonly " $fragmentSpreads": FragmentRefs<"VendorServicesTabFragment_service">;
};
const node: ReaderFragment = {
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "VendorServicesTabFragment_service",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"storageKey": null
}
],
"type": "VendorService",
"abstractKey": null
};
(node as any).hash = "276b5545b9e5eb7f9d9f56c4ea2ed352";
export default node;