Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Add a button to create a product or a service from an order or an invoice #26173

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions htdocs/core/tpl/objectline_create.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,31 @@
<?php
}
}

$parentId = GETPOST('parentId', 'int');

echo '<div id="dropdownAddProductAndService" class="dropdown inline-block">';
echo '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" id="dropdownAddProductAndServiceLink" aria-haspopup="true" aria-expanded="false">';
echo '<span class="fa fa-plus-circle valignmiddle paddingleft"> '.$langs->trans("Add").'</span>';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The picto may be enough (no need for the "Add" label)

echo '</a>';
echo '<div class="dropdown-menu" aria-labelledby="dropdownAddProductAndServiceLink" style="top:auto; left:auto;">';
echo '<a class="dropdown-item" href="'.DOL_URL_ROOT.'/product/card.php?action=create&type=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"> '.$langs->trans("NewProduct").'</a>';
echo '<a class="dropdown-item" href="'.DOL_URL_ROOT.'/product/card.php?action=create&type=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"> '.$langs->trans("NewService").'</a>';
echo '</div>';
echo '</div>';

?>
<script>
$(document).ready(function(){
$("#dropdownAddProductAndService .dropdown-toggle").on("click", function(event) {
console.log("toggle addproduct dropdown");
event.preventDefault();
$("#dropdownAddProductAndService").toggleClass("open");
});
});
</script>
<?php

echo '<input type="hidden" name="pbq" id="pbq" value="">';
echo '</span>';
}
Expand Down
Loading