Compare commits
No commits in common. "4306f561a6d972ecd2f138f4a61aadfc23b0d3bd" and "1b33431bc0fb657acd843e0078753932127a4bab" have entirely different histories.
4306f561a6
...
1b33431bc0
2 changed files with 75 additions and 103 deletions
|
@ -96,7 +96,7 @@ Window {
|
||||||
name: nameT.text,
|
name: nameT.text,
|
||||||
key: keyT.text,
|
key: keyT.text,
|
||||||
amount: parseInt(amountT.text),
|
amount: parseInt(amountT.text),
|
||||||
group_id: "ff664d29-68c9-45c2-a6bc-8f378876c90d",
|
group_id: "f7604976-1e3c-49b7-841b-6a4025257c70",
|
||||||
});
|
});
|
||||||
|
|
||||||
xhr.send(data);
|
xhr.send(data);
|
||||||
|
|
|
@ -4,8 +4,6 @@ import QtQuick.Layouts 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
visible: true
|
|
||||||
|
|
||||||
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
|
SystemPalette { id: activeColors; colorGroup: SystemPalette.Active }
|
||||||
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
|
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive }
|
||||||
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
|
SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled }
|
||||||
|
@ -15,7 +13,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
property string authToken: ""
|
property string authToken: ""
|
||||||
property string searchText: "" // Property to hold the search text
|
|
||||||
|
|
||||||
signal logout()
|
signal logout()
|
||||||
|
|
||||||
|
@ -29,42 +26,44 @@ Rectangle {
|
||||||
height: 50
|
height: 50
|
||||||
color: getColors().midlight
|
color: getColors().midlight
|
||||||
|
|
||||||
RowLayout {
|
TextField {
|
||||||
anchors.fill: parent
|
anchors {
|
||||||
spacing: 10
|
verticalCenter: s1.verticalCenter
|
||||||
anchors.margins: 5
|
rightMargin: 5
|
||||||
|
right: loginB.left
|
||||||
TextField {
|
|
||||||
id: searchField
|
|
||||||
placeholderText: qsTr("Search")
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
Layout.fillWidth: true
|
|
||||||
onTextChanged: {
|
|
||||||
searchText = text
|
|
||||||
filterModel() // Filter model based on search text
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
placeholderText: qsTr("Search")
|
||||||
text: qsTr("Add License")
|
}
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
onClicked: {
|
|
||||||
// Create and show a new window
|
|
||||||
var newWindow = newWindowComponent.createObject(null, { authToken: authToken });
|
|
||||||
if (newWindow !== null) {
|
|
||||||
newWindow.show();
|
|
||||||
} else {
|
|
||||||
console.log("Failed to create new window");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: loginB
|
id: loginB
|
||||||
text: qsTr("Logout")
|
anchors {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
verticalCenter: s1.verticalCenter
|
||||||
onClicked: {
|
rightMargin: 10
|
||||||
logout();
|
right: s1.right
|
||||||
|
}
|
||||||
|
text: qsTr("Logout")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
logout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: qsTr("Add License")
|
||||||
|
anchors {
|
||||||
|
verticalCenter: s1.verticalCenter
|
||||||
|
rightMargin: 10
|
||||||
|
right: loginB.left
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
// Create and show a new window
|
||||||
|
var newWindow = newWindowComponent.createObject(null, { authToken: authToken });
|
||||||
|
if (newWindow !== null) {
|
||||||
|
newWindow.show();
|
||||||
|
} else {
|
||||||
|
console.log("Failed to create new window");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,65 +79,54 @@ Rectangle {
|
||||||
}
|
}
|
||||||
color: getColors().window
|
color: getColors().window
|
||||||
|
|
||||||
ColumnLayout {
|
ListModel {
|
||||||
anchors.fill: parent
|
id: apiDataModel
|
||||||
spacing: 0
|
}
|
||||||
|
|
||||||
Rectangle {
|
ListView {
|
||||||
id: header
|
anchors {
|
||||||
color: getColors().midlight
|
topMargin: 5
|
||||||
height: 40
|
fill: s2
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 10
|
|
||||||
anchors.margins: 5
|
|
||||||
|
|
||||||
Text { text: qsTr("Name"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: qsTr("Key"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: qsTr("Amount"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: qsTr("Start"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: qsTr("End"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: qsTr("Group"); color: getColors().text; Layout.fillWidth: true }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
clip: true
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
ListView {
|
model: apiDataModel
|
||||||
id: listView
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
clip: true
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
model: filteredApiDataModel // Use the filtered model
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Item {
|
||||||
width: listView.width
|
width: parent.width
|
||||||
height: 50
|
height: 50
|
||||||
color: getColors().button
|
|
||||||
|
|
||||||
RowLayout {
|
Row {
|
||||||
anchors.fill: parent
|
spacing: 10
|
||||||
spacing: 10
|
|
||||||
anchors.margins: 5
|
|
||||||
|
|
||||||
Text { text: model.name; color: getColors().text; Layout.fillWidth: true }
|
Text {
|
||||||
Text { text: model.key; color: getColors().text; Layout.fillWidth: true }
|
text: model.name
|
||||||
Text { text: model.amount; color: getColors().text; Layout.fillWidth: true }
|
color: getColors().text
|
||||||
Text { text: model.start; color: getColors().text; Layout.fillWidth: true }
|
}
|
||||||
Text { text: model.end; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.group; color: getColors().text; Layout.fillWidth: true }
|
Text {
|
||||||
|
text: model.key
|
||||||
|
color: getColors().text
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: model.amount
|
||||||
|
color: getColors().text
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: model.start
|
||||||
|
color: getColors().text
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: model.end
|
||||||
|
color: getColors().text
|
||||||
|
}
|
||||||
|
Text {
|
||||||
|
text: model.group
|
||||||
|
color: getColors().text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: apiDataModel
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: filteredApiDataModel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +160,6 @@ Rectangle {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filterModel() // Filter the model after loading data
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Error: " + xhr.status);
|
console.log("Error: " + xhr.status);
|
||||||
}
|
}
|
||||||
|
@ -180,19 +167,4 @@ Rectangle {
|
||||||
}
|
}
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterModel() {
|
|
||||||
filteredApiDataModel.clear()
|
|
||||||
for (var i = 0; i < apiDataModel.count; ++i) {
|
|
||||||
var item = apiDataModel.get(i)
|
|
||||||
if (item.name.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 ||
|
|
||||||
item.key.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 ||
|
|
||||||
item.amount.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 ||
|
|
||||||
item.start.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 ||
|
|
||||||
item.end.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 ||
|
|
||||||
item.group.toLowerCase().indexOf(searchText.toLowerCase()) !== -1) {
|
|
||||||
filteredApiDataModel.append(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue