laravel backpack - creating related models on the fly - laravel-backpack

is it possible to have a onepage-form for editing or creating a entry and its related (1 to n) entrys?
For example: I have a customer model, every customer can have unlimited addresses. I could now have a CustomerCrudController and a AdressCrudController with the adress having select2-field for the customer, maybe having some kind of filter for the customer in the adress-list-view but it would be a more fluid working having the ability to change or add adresses in the customers-edit-view.
Thanks
Christin

There is currently no built-in way to do that right now in a Backpack CRUD create/edit form. It's planned, but will not be happening until the next version of Backpack, which might take as long as 3-6 months to launch.
What you could do is:
1) create your own custom field type, say "select_or_create_address";
2) start from the select2 field type and create your custom functionality:
the results should could be loaded with ajax;
a button next to the select could open a popup with the create address form, either:
a quick form you code yourself that inserts a new address in the db;
the AddressCrudController create form (but without the menu, sidebar, etc); for this you'd need to create another method in the AddressCrudController, base off CrudController::create() but loading a different view;
when the address successfully added, the id should be inserted in the select2 as a value;
My recommendation is to go with the quick form, it should be faster to develop and you wouldn't have to resort to solutions like iFrame popups.
Cheers!

Related

Typo3 Powermail: Export of multiple forms not working - How to add Translations

I have a contact form in different languages. All Forms (1 per language) store their data on a certain page. When I click "Mails" and that storage page, I see a list of all messages from all forms - so far so good.
But when I click CSV Export, I only get the data from one language. After a while of debugging I think I have found the reason - this is because the export service collects the fields from the first message and based on that field list it builds all the other rows. As other messages are from different forms (i.e. languages) there are no corresponding fields for those messages and they are not exported.
Have a look at https://github.com/Intera/typo3-extension-powermail/blob/master/Classes/Domain/Service/ExportService.php --> see function getDefaultFieldListFromFirstMail
Now I am writing to SO instead of Github Bugs, because I still think that there is something wrong with my setup, as Powermail is quite widely used and such an error would have been reported earlier.
The problem was the way I set up the translations of the Powermail forms. I have created a different form for each language, which is not the correct way to do it.
I have found a video which describes the correct process: https://vimeo.com/268654409 .
In the case that the video gets removed, here are some screenshots:
1.) navigate to "LIST" on the the page of your form, select your form and click "Create new Record".
2.) Add a new record "Alternative Page Language"
3.) Select the desired language for the new record and name it properly:
4.) Now you should have a new localization in your powermail fields:
Click on that localization entry to edit / translate it.

MS ACCESS 2013 Displaying Data Rows for users to be able to click and open a new form

I'm just starting to get into Access due to my job and am tasked with creating a form that displays Data for the individual users on load. Basically what it needs to do is to get data from 3 tables, join them together, and then display the found rows that match that person's accounts they are responsible for managing.
I have this working via a single table Query using a listbox and a datasheet view, however, being a web developer by trade, I would like functionality that displays items similar to what a Unordered List(UL) would display and with functionality that allows the user to click on the company name(which acts as a hyperlink) to then update the information in a new form that I have built, by loading that data into the form, and allowing them to update the fields that I have designated as changeable.
Is this possible in Access via a form or would this be too difficult to implement? I'm decent with VBA, still learning what a lot of the things do, but as far as the logic and things like that to make something happen, I can do that no problem. These rows all have a unique ID so I would be able to either keep them in a collection to populate the form data or I can simply requery the data using the ID number for loading the form data.
A listbox performs like a combobox in datasheet view. Did you mean you have a combobox?
Actually very simple to accomplish, and various methods available. I assume you have a form bound to your Query with a combobox that lists companies. Controls have events. Use the Click event of the Company control. I use only VBA (not macros but macro could do this). Select [Event Procedure] in the event property. Click the ellipses (...) to open VBA Code Editor, type code into the procedure:
DoCmd.OpenForm "CompanyInfo", , , "ID=" & Me.tbxCompany
Keep in mind, controls used for the purpose of entering/selecting filter criteria should be UNBOUND, otherwise you would change data in record. However, using the Click event of a BOUND combobox (as long as you click on the box, not the dropdown) or textbox will not change existing data, not so for a listbox.

SYMFONY FORM - filter attribute form on top with submit button, that provides a table with other form used to edit each row details

I am looking for best practices on SYMFONY FORM handling to achieve the following standard page (surprisingly I haven't found anything similar existing yet on SO).
Here is a shema of what I want to achieve:
As you can see at the top there is a SYMFONY FORM to filter the results that should be displayed.
It displays a table and each tuple of the table should permit to open another SYMFONY FORM kind linked to the tuple.
I am in the process of learning SYMFONY FORM, so far, I can manage to create the top row FORM to set the filter that'll apply to the table display.
But I wonder if anyone has experience on the second part: Displaying the table that embed as well many forms of a similar kind -That seems a bit more complex. I read about TWIG.EXTENSION and FORM.COLLECTION, I'll investigate that. But if someone could save me to re-invent the wheel and lead me to some direct shortcut, I'd be really grateful.
No idea if it's the best practice, but one way to do it would be to create a new property for your entity being listed in this table, called $editionForm (without mapping it to the database) for example.
Then, either throught a custom loop or by listening to a doctrine (or any ORM you use) hydration event (or triggering such an event if you don't use any ORM), fill the property with the generated form, probably within a dedicated service.
Then, just use it in your template like this :
$entity->getEditionForm()->render()

Microsoft Access - Why must I be force to use form wizard

Every time I try to create my own form, without using a form wizard base off a table/query, it doesn't seem to work with the subform even thought the forms are connected correctly via master/child links. I tried comparing my dropdownlist/form properties from a wizard version to a custom made. I don't see any difference, why would one work while the other doesn't? am I not seeing something in the background?
Is the form / dropdownlist record source not inter connected in my custom form?
EDIT:
My combo box is now updating the first subform correctly, but it is based off a wizard form. My problem now is getting the subform1 to update subform2. I know I should be creating a new thread. But do you mind taking a quick look. The second subform should be retreiving the ID from subform1 and link it to workOrderID in subform2.
The relationship
Do not be fooled by my workOrder, it is design for only 1 LotNo. However it was originally design for multiple but was change so the user can only enter 1 lot number for 1 work order.
The main form + 2 subform
Subform1 is the first to the top
Subform2 is the bottom one
The links between subform2 and subform1. Subform1 is the first one to the top in the previous picture.

How to track checkboxes with Django and endless pagination?

I am a Django noob and have a situation that goes beyond the basic documentation, etc.
I am updating an ordering webpage that has a form structured as follows:
several text boxes, etc to gather general info (name, date, etc)
two separate tables for selecting (via checkbox) catalogs that are generated/managed using endless_pagination. Each table can have thousands of records, hence the endless_pagination. The first column in each table is a checkbox with value = catalog.id.
a textbox where the user can manually enter catalog IDs
a submit button
I am not sure how to keep track of what a user has selected in the two paginated tables since the checked boxes are lost when choosing a different page. Also, when the user flips back and forth between the pages, the previoulsy checked catalogs will need to be re-checked(since the checked state is not maintained). I am also not sure which tool(s) to use to deal with this.
My thought is to use JavaScript (with which I have minimal experience) to update a list of catalog IDs whenever a checkbox is checked/unchecked and:
- and attach that list to the form or
- update a variable in the form or
- send as a variable separate from the form, whichever is possible/makes more sense.
I'm hoping that maintaining a list of catalog IDs is possible because the next iteration of this form will likely include some sort of filtering so I'm trying to devise a solution that will not have to be reworked later.
I have reviewed a lot of posts but I believe the closest solutions are rendered useless because of the endless_pagination.
Let me know if further clarification is required. Thanks in advance for any suggestions.
UPDATE
I tried using JavaScript to store the catalog IDs in an array when a checkbox is checked. This does not work when a user selects another page in the pagination. The array of checked catalog IDs is lost when the page 'reloads'.
I'm running into this problem right now as well. I'm handling this by writing the checked items to localStorage so they carry across to page 2, 3, etc.. as well as show up as already checked when you go back to page 1. Then every time the page loads, either find and check the existing checkbox, or create a hidden input with the appropriate name and value and append it to the main form.
var selected_items = []
function add_item_to_checkbox(item) {
localStorage.setItem('selected_items', JSON.stringify(selected_items));
checkbox.on("click", add_item_to_checkbox);
bahh... Just look at my jsfiddle it's easier to read and yeah. I don't have to type JS into a textarea on stackoverflow.
Here is my javascript minus a few things that are specific to my code. I'm sure it could be improved upon but it works really well for my application.