Skip to content

Commit

Permalink
Merge branch 'ajout_menu_emprunt'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexproust committed Jan 18, 2025
2 parents 0a25b95 + 81f3547 commit e4b4eb5
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 47 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ qt_add_qml_module(appGestionnaire_dressing
Main.qml
QML_FILES
RESOURCES Data/Photos/Pas-dimage-disponible.jpg Data/Photos/logo.png Theme/QUANTUM/Fonts/Roboto/LICENSE.txt Theme/QUANTUM/Fonts/Roboto/Roboto-Black.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-BlackItalic.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Bold.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-BoldItalic.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Italic.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Light.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-LightItalic.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Medium.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-MediumItalic.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Regular.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-Thin.ttf Theme/QUANTUM/Fonts/Roboto/Roboto-ThinItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Bold.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-BoldItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-ExtraLight.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-ExtraLightItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Italic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Light.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-LightItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Medium.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-MediumItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Regular.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-SemiBold.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-SemiBoldItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-Thin.ttf Theme/QUANTUM/Fonts/Roboto-Mono/static/RobotoMono-ThinItalic.ttf Theme/QUANTUM/Fonts/Roboto-Mono/LICENSE.txt Theme/QUANTUM/Fonts/Roboto-Mono/README.txt Theme/QUANTUM/Fonts/Roboto-Mono/RobotoMono-Italic-VariableFont_wght.ttf Theme/QUANTUM/Fonts/Roboto-Mono/RobotoMono-VariableFont_wght.ttf Theme/QUANTUM/Images/Material_Icons.woff2 Theme/QUANTUM/Images/Material_Icons_Outlined.woff2 Theme/QUANTUM/Images/Material_Icons_Round.woff2 Theme/QUANTUM/Images/Material_Icons_Sharp.woff2 Theme/QUANTUM/Images/Material_Icons_Two_Tone.woff2 Theme/QUANTUM/qmldir
QML_FILES Theme/QUANTUM/Controls/AppliQuantum.qml Theme/QUANTUM/Controls/Button.qml Theme/QUANTUM/Controls/Header.qml Theme/QUANTUM/Controls/Switch.qml Theme/QUANTUM/Controls/Tag.qml Theme/QUANTUM/Colors.qml Theme/QUANTUM/Fonts.qml Database.js DemoDetail.qml DemoTile.qml Filters.qml JSONLoader.qml
QML_FILES Theme/QUANTUM/Controls/AppliQuantum.qml Theme/QUANTUM/Controls/Button.qml Theme/QUANTUM/Controls/Header.qml Theme/QUANTUM/Controls/Switch.qml Theme/QUANTUM/Controls/Tag.qml Theme/QUANTUM/Colors.qml Theme/QUANTUM/Fonts.qml Database.js DetailCostume.qml TileCostume.qml Filters.qml JSONLoader.qml
SOURCES filevalidator.h filevalidator.cpp
QML_FILES SortFilterModel.qml
QML_FILES EmpruntMenu.qml
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
Expand Down
2 changes: 1 addition & 1 deletion Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function dbUpdate(costume)
db.transaction(function (tx) {
tx.executeSql(
'update costume set id=?, type=?, description=?, genre=?, mode=?, epoque=?, couleur=?, taille=?, etat=?, emplacement=?, emprunteur=?, date_emprunt=?, date_versement_caution=?, date_retour=?, date_remoursement_caution=?, commentaires=? where rowid = ?',
[costume.id, costume.type, costume.description, costume.genre, costume.mode, costume.epoque, costume.couleur, costume.taille, costume.etat, costume.emplacement, costume.emprunteur, "", "", "", "", "", costume.id])
[costume.id, costume.type, costume.description, costume.genre, costume.mode, costume.epoque, costume.couleur, costume.taille, costume.etat, costume.emplacement, costume.emprunteur, costume.date_emprunt, "", costume.date_retour, "", "", costume.id])
})
}

Expand Down
131 changes: 89 additions & 42 deletions DemoDetail.qml → DetailCostume.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ import Gestionnaire_dressing 1.0
Rectangle {
id: demoDetail
property var costumeSelected: ({})
property string type: ""
property string description: ""
property string genre: ""
property string mode: ""
property string epoque: ""
property string couleur: ""
property string taille: ""
property string etat: ""
property string emplacement: ""
property bool editMode: false
property var filter: ({})
width: parent.width - 100
height: parent.height - 100
anchors.centerIn: parent
radius: 50
visible: false
color: Colors.bluegrey25
color: Colors.bluegrey50
signal recordModification()
signal deleteCostume()
signal duplicateCostume()
signal emprunterCostume()

MouseArea {
width: parent.width + 100
Expand All @@ -45,7 +55,17 @@ Rectangle {
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: 16
onClicked: demoDetail.editMode = !demoDetail.editMode
onClicked: {
if (!demoDetail.editMode){
demoDetail.type = costumeSelected.type
demoDetail.genre = costumeSelected.genre
demoDetail.couleur = costumeSelected.couleur
demoDetail.etat = costumeSelected.etat
demoDetail.taille = costumeSelected.taille
demoDetail.description = costumeSelected.description
}
demoDetail.editMode = !demoDetail.editMode
}
}

Button {
Expand All @@ -70,15 +90,32 @@ Rectangle {
}
}

Button {
id: emprunterButton
text: "Emprunter"
anchors.left: duplicateButton.right
anchors.top: parent.top
anchors.margins: 16
onClicked: {
demoDetail.emprunterCostume()
}
}

Button {
text: demoDetail.editMode ? "Sauvegarder" : "Fermer"
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 16
onClicked: {
if (demoDetail.editMode){
demoDetail.editMode = !demoDetail.editMode
costumeSelected.type = demoDetail.type
costumeSelected.genre = demoDetail.genre
costumeSelected.couleur = demoDetail.couleur
costumeSelected.etat = demoDetail.etat
costumeSelected.taille = demoDetail.taille
costumeSelected.description = demoDetail.description
demoDetail.recordModification()
demoDetail.editMode = !demoDetail.editMode
}
else {
parent.visible = false
Expand Down Expand Up @@ -129,13 +166,13 @@ Rectangle {
Layout.preferredHeight: 64
visible: demoDetail.editMode
model: filter.type
onCurrentIndexChanged: {
console.log("onCurrentIndexChanged " + filter.type[currentIndex])
costumeSelected.type = filter.type[currentIndex]
}
// onCurrentIndexChanged: {
// console.log("onCurrentIndexChanged " + filter.type[currentIndex])
// type = filter.type[currentIndex]
// }
onActivated: {
console.log("onActivated " + filter.type[currentIndex])
costumeSelected.type = filter.type[currentIndex]
demoDetail.type = filter.type[currentIndex]
console.log("onActivated " + demoDetail.type)
}
onVisibleChanged: {
currentIndex = indexOfValue(costumeSelected.type)
Expand All @@ -153,12 +190,12 @@ Rectangle {
}
TextArea {
id: descriptionInput
text: costumeSelected.description ? costumeSelected.description : ""
text: description
Layout.fillWidth: true
Layout.preferredHeight: 64
visible: demoDetail.editMode
onTextChanged: {
costumeSelected.description = text
description = text
}
}
}
Expand All @@ -179,12 +216,12 @@ Rectangle {
Layout.preferredHeight: 64
visible: demoDetail.editMode
model: filter.genre
onCurrentIndexChanged: {
costumeSelected.genre = filter.genre[currentIndex]
}
// onCurrentIndexChanged: {
// costumeSelected.genre = filter.genre[currentIndex]
// }
onActivated: {
console.log("onActivated " + filter.genre[currentIndex])
costumeSelected.genre = filter.genre[currentIndex]
genre = filter.genre[currentIndex]
console.log("onActivated " + genre)
}
onVisibleChanged: {
currentIndex = indexOfValue(costumeSelected.genre)
Expand Down Expand Up @@ -248,12 +285,12 @@ Rectangle {
Layout.preferredHeight: 64
visible: demoDetail.editMode
model: filter.couleur
onCurrentIndexChanged: {
costumeSelected.couleur = filter.couleur[currentIndex]
}
// onCurrentIndexChanged: {
// costumeSelected.couleur = filter.couleur[currentIndex]
// }
onActivated: {
console.log("onActivated " + filter.couleur[currentIndex])
costumeSelected.couleur = filter.couleur[currentIndex]
couleur = filter.couleur[currentIndex]
console.log("onActivated " + couleur)
}
onVisibleChanged: {
currentIndex = indexOfValue(costumeSelected.couleur)
Expand All @@ -277,12 +314,12 @@ Rectangle {
Layout.preferredHeight: 64
visible: demoDetail.editMode
model: filter.taille
onCurrentIndexChanged: {
costumeSelected.taille = filter.taille[currentIndex]
}
// onCurrentIndexChanged: {
// costumeSelected.taille = filter.taille[currentIndex]
// }
onActivated: {
console.log("onActivated " + filter.taille[currentIndex])
costumeSelected.taille = filter.taille[currentIndex]
taille = filter.taille[currentIndex]
console.log("onActivated " + taille)
}
onVisibleChanged: {
currentIndex = indexOfValue(costumeSelected.taille)
Expand All @@ -306,37 +343,47 @@ Rectangle {
Layout.preferredHeight: 64
visible: demoDetail.editMode
model: filter.etat
onCurrentIndexChanged: {
costumeSelected.etat = filter.etat[currentIndex]
}
// onCurrentIndexChanged: {
// costumeSelected.etat = filter.etat[currentIndex]
// }
onActivated: {
console.log("onActivated " + filter.etat[currentIndex])
costumeSelected.etat = filter.etat[currentIndex]
etat = filter.etat[currentIndex]
console.log("onActivated " + etat)
}
onVisibleChanged: {
currentIndex = indexOfValue(costumeSelected.etat)
}
}
}

// RowLayout {
// Text {
// Layout.fillWidth: true
// Layout.preferredHeight: 64
// text: !demoDetail.editMode ? "Emplacement: " + costumeSelected.emplacement : "Emplacement: "
// font: Fonts.body1
// wrapMode: Text.WordWrap
// }
// TextField {
// id: placementInput
// text: costumeSelected.emplacement ? costumeSelected.emplacement : ""
// Layout.fillWidth: true
// Layout.preferredHeight: 64
// visible: demoDetail.editMode
// onTextChanged: {
// costumeSelected.emplacement = text
// }
// }
// }

RowLayout {
Text {
Layout.fillWidth: true
Layout.preferredHeight: 64
text: !demoDetail.editMode ? "Emplacement: " + costumeSelected.emplacement : "Emplacement: "
text: costumeSelected.emprunteur ? "Emprunteur: " + costumeSelected.emprunteur : "Disponible à l'emprunt"
font: Fonts.body1
wrapMode: Text.WordWrap
}
TextField {
id: placementInput
text: costumeSelected.emplacement ? costumeSelected.emplacement : ""
Layout.fillWidth: true
Layout.preferredHeight: 64
visible: demoDetail.editMode
onTextChanged: {
costumeSelected.emplacement = text
}
}
}
}
}
Expand Down
Loading

0 comments on commit e4b4eb5

Please sign in to comment.