Compare commits
No commits in common. "e398cbb1f77a5cb08c963665b961b35e432c92b2" and "e26c33533f5a2ccca349bc74d1a8c1b4bf33f117" have entirely different histories.
e398cbb1f7
...
e26c33533f
2 changed files with 21 additions and 64 deletions
|
@ -22,10 +22,6 @@ Window {
|
||||||
|
|
||||||
property string authToken: ""
|
property string authToken: ""
|
||||||
|
|
||||||
ListModel {
|
|
||||||
id: groupsModel
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: nameT
|
id: nameT
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -67,18 +63,6 @@ Window {
|
||||||
text = text.replace(/[^0-9]/g, "")
|
text = text.replace(/[^0-9]/g, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: groupSelector.focus = true
|
|
||||||
}
|
|
||||||
|
|
||||||
ComboBox {
|
|
||||||
id: groupSelector
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
topMargin: 5
|
|
||||||
top: amountT.bottom
|
|
||||||
}
|
|
||||||
model: groupsModel
|
|
||||||
textRole: "name"
|
|
||||||
Keys.onReturnPressed: submitB.focus = true
|
Keys.onReturnPressed: submitB.focus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +71,7 @@ Window {
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
topMargin: 5
|
topMargin: 5
|
||||||
top: groupSelector.bottom
|
top: amountT.bottom
|
||||||
}
|
}
|
||||||
text: qsTr("Submit")
|
text: qsTr("Submit")
|
||||||
|
|
||||||
|
@ -112,31 +96,9 @@ Window {
|
||||||
name: nameT.text,
|
name: nameT.text,
|
||||||
key: keyT.text,
|
key: keyT.text,
|
||||||
amount: parseInt(amountT.text),
|
amount: parseInt(amountT.text),
|
||||||
group_id: groupSelector.currentIndex !== -1 ? groupsModel.get(groupSelector.currentIndex).id : "",
|
group_id: "ff664d29-68c9-45c2-a6bc-8f378876c90d",
|
||||||
});
|
});
|
||||||
|
|
||||||
xhr.send(data);
|
xhr.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchGroups() {
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("GET", "https://api.clan-war.net/api/v1/licenses");
|
|
||||||
xhr.setRequestHeader("Authorization", "Bearer " + authToken);
|
|
||||||
xhr.onreadystatechange = function() {
|
|
||||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
||||||
if (xhr.status === 200) {
|
|
||||||
var response = JSON.parse(xhr.responseText);
|
|
||||||
groupsModel.clear();
|
|
||||||
for (var i = 0; i < response.length; i++) {
|
|
||||||
groupsModel.append(response[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log("Failed to fetch groups: " + xhr.status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: fetchGroups()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,35 +104,30 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ListView {
|
||||||
|
id: listView
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
clip: true
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
model: filteredApiDataModel // Use the filtered model
|
||||||
|
|
||||||
ListView {
|
delegate: Rectangle {
|
||||||
id: listView
|
width: listView.width
|
||||||
Layout.fillWidth: true
|
height: 50
|
||||||
Layout.fillHeight: true
|
color: getColors().button
|
||||||
clip: true
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
model: filteredApiDataModel // Use the filtered model
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
RowLayout {
|
||||||
width: listView.width
|
anchors.fill: parent
|
||||||
height: 50
|
spacing: 10
|
||||||
color: getColors().button
|
anchors.margins: 5
|
||||||
|
|
||||||
RowLayout {
|
Text { text: model.name; color: getColors().text; Layout.fillWidth: true }
|
||||||
anchors.fill: parent
|
Text { text: model.key; color: getColors().text; Layout.fillWidth: true }
|
||||||
spacing: 10
|
Text { text: model.amount; color: getColors().text; Layout.fillWidth: true }
|
||||||
anchors.margins: 5
|
Text { text: model.start; color: getColors().text; Layout.fillWidth: true }
|
||||||
|
Text { text: model.end; color: getColors().text; Layout.fillWidth: true }
|
||||||
Text { text: model.name; color: getColors().text; Layout.fillWidth: true }
|
Text { text: model.group; color: getColors().text; Layout.fillWidth: true }
|
||||||
Text { text: model.key; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
Text { text: model.amount; color: getColors().text; Layout.fillWidth: true }
|
|
||||||
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 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue