coopcycle / coopcycle-app

CoopCycle native app
MIT License
151 stars 33 forks source link

Delivery form in app #1522

Closed DanielBustillos closed 1 year ago

DanielBustillos commented 1 year ago

As mentioned in #3672 I would like to request the implementation of an in-app delivery request feature to enable users to place delivery deliveries ("encargos") from point A to point B within the CoopCycle app. This functionality is available through a delivery form or as a user with a store account, but it is not directly accessible from the app itself.

In order to achieve something The objective is to provide a more streamlined and convenient way for users to request orders through the CoopCycle app.

As a role As a final user of the CoopCycle app.

I want something to be added or changed I want to have a way to set up deliveries directly from the app. Currently, this can be done through a form on the homepage, but it should also be accessible within the app.

Whereas currently this happens Currently, a form setup on the homepage allows for delivery requests, but it is not integrated into the app itself. This form has been partially implemented by @AwesomeKuro

Additional context

Additional context: This feature request has been inspired by feedback and input from various courier services in Mexico. @AwesomeKuro can implement this with @alexsegura and @@Paul-Eraman-CoopCycle .

Thank you 😀.

alexsegura commented 1 year ago

First, we need to expose the form URL in the /api/settings endpoint, so that the app can retrieve it. For example, in default_delivery_form_url property.

The default delivery form is the one that has the showHomepage property set to true. It should be easy to retrieve it like this:

$defaultDeliveryForm = $this->getDoctrine()->getRepository(DeliveryForm::class)->findOneBy(['showHomepage' => true])

⚠️ There isn't necessarily a default delivery form configured, so default_delivery_form_url might be NULL


Then, to implement it on the app, the very simplest way to implement it would be to use Linking.openURL, so that it opens a browser window with the form, and basta.

AwesomeKuro commented 1 year ago

What about authentication? Can we pass a token to the url so we can use the authenticated user to the form? Or is there any other way?

alexsegura commented 1 year ago

@AwesomeKuro this form doesn't require authentication.

AwesomeKuro commented 1 year ago

Solved with https://github.com/coopcycle/coopcycle-web/pull/3729

1527

This is just linking the delivery form... It just choses the first Delivery Form matching "show on homepage"