Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add order views titles
dominik-zeglenfc510e573a93
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsxindex b4e690bc14..53b2d17811 100644--- a/saleor/static/dashboard-next/orders/index.tsx+++ b/saleor/static/dashboard-next/orders/index.tsx@@ -2,6 +2,7 @@ import { parse as parseQs } from "qs";import * as React from "react";import { Route, RouteComponentProps, Switch } from "react-router-dom";+import { WindowTitle } from "../components/WindowTitle";import i18n from "../i18n";import { maybe } from "../misc";import { OrderStatus, PaymentChargeStatusEnum } from "../types/globalTypes";@@ -26,10 +27,13 @@ const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({};const Component = ({ match }) => (- <Switch>- <Route exact path={match.url} component={OrderList} />- <Route exact path={`${match.url}/:id/`} component={OrderDetails} />- </Switch>+ <>+ <WindowTitle title={i18n.t("Orders")} />+ <Switch>+ <Route exact path={match.url} component={OrderList} />+ <Route exact path={`${match.url}/:id/`} component={OrderDetails} />+ </Switch>+ </>);export interface AddressType {diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails.tsxindex 43392dffd6..02f790d44d 100644--- a/saleor/static/dashboard-next/orders/views/OrderDetails.tsx+++ b/saleor/static/dashboard-next/orders/views/OrderDetails.tsx@@ -4,6 +4,7 @@ import { orderListUrl } from "..";import ErrorMessageCard from "../../components/ErrorMessageCard";import Messages from "../../components/messages";import Navigator from "../../components/Navigator";+import { WindowTitle } from "../../components/WindowTitle";import i18n from "../../i18n";import { maybe } from "../../misc";import { productUrl } from "../../products";@@ -337,264 +338,278 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({}};return (- <OrderOperations- order={id}- onError={undefined}- onOrderFulfillmentCreate={- handleOrderFulfillmentCreate- }- onNoteAdd={handleNoteAdd}- onOrderCancel={handleOrderCancel}- onOrderVoid={handleOrderVoid}- onPaymentCapture={handlePaymentCapture}- onPaymentRefund={handlePaymentRefund}- onUpdate={handleUpdate}- onDraftUpdate={handleDraftUpdate}- onShippingMethodUpdate={handleShippingMethodUpdate}- onOrderLineDelete={handleLineDelete}- onOrderLineAdd={handleLineAdd}- onOrderLineUpdate={handleLineUpdate}- onOrderFulfillmentCancel={handleFulfillmentCancel}- onOrderFulfillmentUpdate={handleFulfillmentUpdate}- onDraftFinalize={handleDraftFinalize}- onDraftCancel={handleOrderDraftCancel}- onOrderMarkAsPaid={handleMarkAsPaid}- >- {({- errors,- orderAddNote,- orderCancel,- orderCreateFulfillment,- orderDraftUpdate,- orderLineAdd,- orderLineDelete,- orderLineUpdate,- orderPaymentCapture,- orderPaymentRefund,- orderVoid,- orderShippingMethodUpdate,- orderUpdate,- orderFulfillmentCancel,- orderFulfillmentUpdateTracking,- orderDraftCancel,- orderDraftFinalize,- orderPaymentMarkAsPaid- }) =>- maybe(- () => order.status !== OrderStatus.DRAFT- ) ? (- <OrderDetailsPage- errors={errors}- onNoteAdd={variables =>- orderAddNote.mutate({- input: variables,- order: id- })- }- onBack={() => navigate(orderListUrl)}- order={order}- countries={maybe(- () => data.shop.countries,- []- ).map(country => ({- code: country.code,- label: country.country- }))}- shippingMethods={maybe(- () => data.order.availableShippingMethods,- []- )}- onOrderCancel={variables =>- orderCancel.mutate({+ <>+ <WindowTitle+ title={maybe(() => "#" + data.order.number)}+ />+ <OrderOperations+ order={id}+ onError={undefined}+ onOrderFulfillmentCreate={+ handleOrderFulfillmentCreate+ }+ onNoteAdd={handleNoteAdd}+ onOrderCancel={handleOrderCancel}+ onOrderVoid={handleOrderVoid}+ onPaymentCapture={handlePaymentCapture}+ onPaymentRefund={handlePaymentRefund}+ onUpdate={handleUpdate}+ onDraftUpdate={handleDraftUpdate}+ onShippingMethodUpdate={+ handleShippingMethodUpdate+ }+ onOrderLineDelete={handleLineDelete}+ onOrderLineAdd={handleLineAdd}+ onOrderLineUpdate={handleLineUpdate}+ onOrderFulfillmentCancel={handleFulfillmentCancel}+ onOrderFulfillmentUpdate={handleFulfillmentUpdate}+ onDraftFinalize={handleDraftFinalize}+ onDraftCancel={handleOrderDraftCancel}+ onOrderMarkAsPaid={handleMarkAsPaid}+ >+ {({+ errors,+ orderAddNote,+ orderCancel,+ orderCreateFulfillment,+ orderDraftUpdate,+ orderLineAdd,+ orderLineDelete,+ orderLineUpdate,+ orderPaymentCapture,+ orderPaymentRefund,+ orderVoid,+ orderShippingMethodUpdate,+ orderUpdate,+ orderFulfillmentCancel,+ orderFulfillmentUpdateTracking,+ orderDraftCancel,+ orderDraftFinalize,+ orderPaymentMarkAsPaid+ }) =>+ maybe(+ () => order.status !== OrderStatus.DRAFT+ ) ? (+ <OrderDetailsPage+ errors={errors}+ onNoteAdd={variables =>+ orderAddNote.mutate({+ input: variables,+ order: id+ })+ }+ onBack={() => navigate(orderListUrl)}+ order={order}+ countries={maybe(+ () => data.shop.countries,+ []+ ).map(country => ({+ code: country.code,+ label: country.country+ }))}+ shippingMethods={maybe(+ () => data.order.availableShippingMethods,+ []+ )}+ onOrderCancel={variables =>+ orderCancel.mutate({+ id,+ ...variables+ })+ }+ onOrderFulfill={variables =>+ orderCreateFulfillment.mutate({+ input: {+ ...variables,+ lines: maybe(() => order.lines, [])+ .filter(+ line =>+ line.quantityFulfilled <+ line.quantity+ )+ .map((line, lineIndex) => ({+ orderLineId: line.id,+ quantity:+ variables.lines[lineIndex]+ }))+ .filter(line => line.quantity > 0)+ },+ order: order.id+ })+ }+ onFulfillmentCancel={(id, variables) =>+ orderFulfillmentCancel.mutate({+ id,+ input: variables+ })+ }+ onFulfillmentTrackingNumberUpdate={(id,- ...variables- })- }- onOrderFulfill={variables =>- orderCreateFulfillment.mutate({- input: {+ variables+ ) =>+ orderFulfillmentUpdateTracking.mutate({+ id,+ input: {+ ...variables,+ notifyCustomer: true+ }+ })+ }+ onPaymentCapture={variables =>+ orderPaymentCapture.mutate({+ ...variables,+ id+ })+ }+ onPaymentVoid={() =>+ orderVoid.mutate({ id })+ }+ onPaymentRefund={variables =>+ orderPaymentRefund.mutate({...variables,- lines: maybe(() => order.lines, [])- .filter(- line =>- line.quantityFulfilled <- line.quantity+ id+ })+ }+ onProductClick={id => () =>+ navigate(+ productUrl(encodeURIComponent(id))+ )}+ onBillingAddressEdit={variables =>+ orderUpdate.mutate({+ id,+ input: {+ billingAddress: variables+ }+ })+ }+ onShippingAddressEdit={variables =>+ orderUpdate.mutate({+ id,+ input: {+ shippingAddress: variables+ }+ })+ }+ onPaymentPaid={() =>+ orderPaymentMarkAsPaid.mutate({ id })+ }+ />+ ) : (+ <OrderDraftPage+ disabled={loading}+ errors={errors}+ onNoteAdd={variables =>+ orderAddNote.mutate({+ input: variables,+ order: id+ })+ }+ fetchVariants={search}+ variants={maybe(() =>+ searchOpts.data.products.edges+ .map(edge => edge.node)+ .map(product => ({+ ...product,+ variants: product.variants.edges.map(+ edge => edge.node)- .map((line, lineIndex) => ({- orderLineId: line.id,- quantity: variables.lines[lineIndex]+ }))+ .map(product =>+ product.variants.map(variant => ({+ ...variant,+ name: `${product.name}(${+ variant.name+ })`}))- .filter(line => line.quantity > 0)- },- order: order.id- })- }- onFulfillmentCancel={(id, variables) =>- orderFulfillmentCancel.mutate({- id,- input: variables- })- }- onFulfillmentTrackingNumberUpdate={(- id,- variables- ) =>- orderFulfillmentUpdateTracking.mutate({- id,- input: {- ...variables,- notifyCustomer: true- }- })- }- onPaymentCapture={variables =>- orderPaymentCapture.mutate({- ...variables,- id- })- }- onPaymentVoid={() => orderVoid.mutate({ id })}- onPaymentRefund={variables =>- orderPaymentRefund.mutate({- ...variables,- id- })- }- onProductClick={id => () =>- navigate(- productUrl(encodeURIComponent(id))+ )+ .reduce(+ (prev, curr) => prev.concat(curr),+ []+ ))}- onBillingAddressEdit={variables =>- orderUpdate.mutate({- id,- input: {- billingAddress: variables- }- })- }- onShippingAddressEdit={variables =>- orderUpdate.mutate({- id,- input: {- shippingAddress: variables- }- })- }- onPaymentPaid={() =>- orderPaymentMarkAsPaid.mutate({ id })- }- />- ) : (- <OrderDraftPage- disabled={loading}- errors={errors}- onNoteAdd={variables =>- orderAddNote.mutate({- input: variables,- order: id- })- }- fetchVariants={search}- variants={maybe(() =>- searchOpts.data.products.edges- .map(edge => edge.node)- .map(product => ({- ...product,- variants: product.variants.edges.map(+ users={maybe(+ () =>+ users.searchOpts.data.customers.edges.map(edge => edge.node- )- }))- .map(product =>- product.variants.map(variant => ({- ...variant,- name: `${product.name}(${- variant.name- })`- }))- )- .reduce(- (prev, curr) => prev.concat(curr),- []- )- )}- users={maybe(- () =>- users.searchOpts.data.customers.edges.map(- edge => edge.node- ),- []- )}- variantsLoading={searchOpts.loading}- fetchUsers={users.search}- usersLoading={users.searchOpts.loading}- onCustomerEdit={data =>- orderDraftUpdate.mutate({ id, input: data })- }- onDraftFinalize={() =>- orderDraftFinalize.mutate({ id })- }- onDraftRemove={() =>- orderDraftCancel.mutate({ id })- }- onOrderLineAdd={variables =>- orderLineAdd.mutate({- id,- input: {- quantity: variables.quantity,- variantId: variables.variant.value- }- })- }- onBack={() => navigate(orderListUrl)}- order={order}- countries={maybe(- () => data.shop.countries,- []- ).map(country => ({- code: country.code,- label: country.country- }))}- onProductClick={id => () =>- navigate(- productUrl(encodeURIComponent(id))+ ),+ [])}- onBillingAddressEdit={variables =>- orderUpdate.mutate({- id,- input: {- billingAddress: variables- }- })- }- onShippingAddressEdit={variables =>- orderUpdate.mutate({- id,- input: {- shippingAddress: variables- }- })- }- onShippingMethodEdit={variables =>- orderShippingMethodUpdate.mutate({- id,- input: {- shippingMethod: variables.shippingMethod- }- })- }- onOrderLineRemove={id =>- orderLineDelete.mutate({ id })- }- onOrderLineChange={(id, data) =>- orderLineUpdate.mutate({- id,- input: data- })- }- />- )- }- </OrderOperations>+ variantsLoading={searchOpts.loading}+ fetchUsers={users.search}+ usersLoading={users.searchOpts.loading}+ onCustomerEdit={data =>+ orderDraftUpdate.mutate({+ id,+ input: data+ })+ }+ onDraftFinalize={() =>+ orderDraftFinalize.mutate({ id })+ }+ onDraftRemove={() =>+ orderDraftCancel.mutate({ id })+ }+ onOrderLineAdd={variables =>+ orderLineAdd.mutate({+ id,+ input: {+ quantity: variables.quantity,+ variantId: variables.variant.value+ }+ })+ }+ onBack={() => navigate(orderListUrl)}+ order={order}+ countries={maybe(+ () => data.shop.countries,+ []+ ).map(country => ({+ code: country.code,+ label: country.country+ }))}+ onProductClick={id => () =>+ navigate(+ productUrl(encodeURIComponent(id))+ )}+ onBillingAddressEdit={variables =>+ orderUpdate.mutate({+ id,+ input: {+ billingAddress: variables+ }+ })+ }+ onShippingAddressEdit={variables =>+ orderUpdate.mutate({+ id,+ input: {+ shippingAddress: variables+ }+ })+ }+ onShippingMethodEdit={variables =>+ orderShippingMethodUpdate.mutate({+ id,+ input: {+ shippingMethod:+ variables.shippingMethod+ }+ })+ }+ onOrderLineRemove={id =>+ orderLineDelete.mutate({ id })+ }+ onOrderLineChange={(id, data) =>+ orderLineUpdate.mutate({+ id,+ input: data+ })+ }+ />+ )+ }+ </OrderOperations>+ </>);}}</OrderVariantSearchProvider>