Added the ability to create a doctype from our page.

This commit is contained in:
rocketdebris 2025-10-20 18:25:05 -04:00
parent 3a942001d2
commit bece353366
3 changed files with 21 additions and 4 deletions

View File

@ -1,16 +1,23 @@
#sidebar {
display: flex;
flex-direction: column;
width: 100px;
width: 150px;
align-self: flex-start;
gap: 10px;
background-color: rgb(54, 54, 58);
background-color: #f3f3f3;
padding: 10px;
border-radius: 5px;
}
.sidebar-button {
border-radius: 5px;
border: none;
background-color: skyblue;
background-color: rgb(69, 112, 101);
color: white;
}
.sidebar-button:hover {
background-color: rgb(82, 132, 119)
}
#snw-ui {
@ -60,6 +67,7 @@
#filter-container {
display: flex;
flex-direction: row;
gap: 5px 5px;
}
#paging-controls {

View File

@ -3,7 +3,7 @@
<div id=filter-container class=filter-container>
<input placeholder="Type to Search"></input>
<p>Type:</p><select id=type-selector></select>
<button id=add-customer-button class=interaction-button>Add</button>
<button id=new-customer-button class=interaction-button>New</button>
</div>
<div id=datatable-and-controls></div>
</div>

View File

@ -54,6 +54,7 @@ class View {
constructor(page) {
this.$sidebar = $("#sidebar", page);
this.$displayContent = $("#display-content", page);
this.$newCustomerButton;
}
setSidebarCategories(categories, click_handler) {
@ -69,6 +70,14 @@ class View {
setDisplayTemplate(template) {
this.$displayContent.html(frappe.render_template(template, this.$displayContent));
if (template == "clients") {
this.$newCustomerButton = $("#new-customer-button", this.$displayContent);
this.$newCustomerButton.on("click", this.handleNewButton);
}
}
handleNewButton() {
frappe.new_doc('Customer');
}
setDisplayContent(content) {