The following pages are required to be created in order to implement the electronic request user interface:
Showing the Requests List
Create a new page (e.g. index.php) on which surface we will show the existing requests.
In the visual editor, create a table which will serve as a layout grid for the links to a request creation page form.php (this will be discussed later). Click Insert table () on the editor toolbar. Specify the required layout data in the new table dialog:
To each table cell, insert an image and type the link text, e.g. Courier delivery, Cards etc:
Select the link text and click Hyperlink (). In the link dialog, select Link to document on server as a link Type; ; and specify the request creation page URL in the Document field. The URL must include the form symbolic ID, for example: (/services/requests/form.php?WEB_FORM_ID=VISITOR_ACCESS).
Click Save. Create other links in the similar manner.
Now the page may look like this:
The Request Creation Page
Create a new page and save it as form.php. A user will open this page whenever they want to create and submit a new electronic request. Add the Web Form Completion (bitrix:form.result.new) component to it:
Select requests as the component template. Scroll the component properties pane to the Page address management group. Since the web form ID will be passed in the URL from the requests page, type $_REQUEST["WEB_FORM_ID"] in the Web form ID field. Other fields can be left as they are. Click Save.
Now this page will show the request completion form (the fields depend on the request a user selects):
The Personal Requests Page
In order to enable a user to view the requests they have submitted, create a page and add the My Results (bitrix:form.result.list.my) component to it:
In the component properties, select the web forms whose results a user can view (in the Forms listbox). Scroll to the Additionally section and specify the pages in which a user will view and edit the requests, and the page that will show the list of requests filtered by a user-supplied criteria.
Save the page as my.php. When opened in the public section, it can show the following results:
The Personal Requests Page with Filters
The my.php page shows all the requests a user has made (depending on the My Results component parameters). To show the requests of a particular type, we need to set up a page that would accept the type of request and render all the requests of this type.
Create a page form_list.php and add the List of Results (bitrix:form.result.list) component to it. A user can access this page by clicking a link like all links of this type on my.php.
Select intranet as a component template. Select (other)-> as the web form ID to enable passing it from the my.php page. Specify the request view and edit pages (you will find their discussion below). Specify the requests main page (index.php) as a new result creation page.
Save the page. Now if you view it in the public section, you would see something similar to the following:
The request view and edit pages
In order to enable a user to view and edit the request parameters, we have to create two pages: form_view.php and form_edit.php. Add the View Result (bitrix:form.result.view) component to the view page, and the Result Editing (bitrix:form.result.edit) component to the editor page. Select the intranet template for the View Result component:
In the parameters of the both components, select (other)-> as the web form ID to enable passing it from the my.php page.
Specify the request editor page (form_edit.php) in the View Result component parameters; the request view page and the requests main page in the Result Editing component parameters.
We would obviously need to allow a user to view the comments an administrator or other employees leave, but disallow a user to edit the comments. To do so, check the Show auxiliary web form fields option in the View Result component parameters. Then, in the Edit Result component parameters, set the User can edit auxiliary fields parameters to No.
Save changes. Now the request page would look like shown below:
The request editor page:
Note: the user permission to view and edit a request in any status is the subject of the status access permission.
Creating Request |