Skip to content

Commit

Permalink
📚 docs: Atualizando arquivo
Browse files Browse the repository at this point in the history
  • Loading branch information
yasmincsme committed Jun 18, 2023
1 parent 7ba5adc commit 78675fd
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 415 deletions.
659 changes: 263 additions & 396 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file modified clients.dat
Binary file not shown.
Binary file modified orders.dat
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.IOException;
import java.util.List;
import java.util.Objects;

public class OrdersController extends MenuController{

Expand Down Expand Up @@ -67,6 +68,7 @@ public class OrdersController extends MenuController{
private void initialize(){
selectedOrder = null;
initializeTable();
updateValues();
}

private void initializeTable(){
Expand Down Expand Up @@ -104,6 +106,28 @@ private void initializeTable(){
}
}

public void updateValues() {
int totalOrders = 0;
int canceledOrders = 0;
int pendignOrders = 0;
int openedOrders = 0;
List<WorkOrder> orderList = DAO.getWorkOrder().findMany();
for(WorkOrder workOrder : orderList) {
totalOrders += 1;
if (Objects.equals(workOrder.getStatus(), "OPEN")) {
openedOrders += 1;
} else if (Objects.equals(workOrder.getStatus(), "CANCELED")) {
canceledOrders += 1;
} else {
pendignOrders += 1;
}
}
this.numTotalLabel.setText(String.valueOf(totalOrders));
this.numCanceledLabel.setText(String.valueOf(canceledOrders));
this.numCompletedLabel.setText(String.valueOf(pendignOrders));
this.numOrdersLabel.setText(String.valueOf(openedOrders));
}

@FXML
void removeOrder(ActionEvent event) throws IOException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.exa863_management_system_2023.dao.DAO;
import com.example.exa863_management_system_2023.exceptions.InvalidSatisfactionScore;
import com.example.exa863_management_system_2023.exceptions.ObjectNotFoundException;
import com.example.exa863_management_system_2023.exceptions.WorkOrderWithoutTechnician;
import com.example.exa863_management_system_2023.model.WorkOrder;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
Expand All @@ -16,35 +17,30 @@

public class UpdateOrderController {

@FXML
private TextField IDField;

//Button
@FXML
private Button cancelButton;

@FXML
private TextField clientIDField;
private Button saveButton;

@FXML
private TextField costField;

//Field
@FXML
private TextField descriptionField;

@FXML
private TextField paymentMethodField;

private TextField clientIDField;
@FXML
private TextField technicianID;
@FXML
private TextField statusField;
@FXML
private TextField priceField;

@FXML
private TextField satisfactionScoreField;

private TextField costField;
@FXML
private Button saveButton;

private TextField satisfactionScoreField;
@FXML
private TextField technicianID;
private TextField paymentMethodField;

@FXML
void cancelOperation(ActionEvent event) throws IOException {
Expand All @@ -54,7 +50,7 @@ void cancelOperation(ActionEvent event) throws IOException {
}

@FXML
void saveOrder(ActionEvent event) throws InvalidSatisfactionScore, ObjectNotFoundException, IOException {
void saveOrder(ActionEvent event) throws InvalidSatisfactionScore, ObjectNotFoundException, IOException, WorkOrderWithoutTechnician {
WorkOrder order = (WorkOrder) OrdersController.selectedOrder;

if (!descriptionField.getText().isEmpty()) {
Expand All @@ -66,6 +62,17 @@ void saveOrder(ActionEvent event) throws InvalidSatisfactionScore, ObjectNotFoun
if (!technicianID.getText().isEmpty()) {
order.setTechnicianID(technicianID.getText());
}
if (!statusField.getText().isEmpty()) {
if (statusField.getText().toLowerCase().charAt(0) == 'o') {
order.reopen();
}
if (statusField.getText().toLowerCase().charAt(0) == 'c') {
order.cancel();
}
if (statusField.getText().toLowerCase().charAt(0) == 'f') {
order.finish();
}
}
if (!priceField.getText().isEmpty()) {
order.setPrice(Double.parseDouble(priceField.getText()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<Font size="19.0" />
</font>
</Label>
<AnchorPane layoutX="81.0" layoutY="99.0" prefHeight="402.0" prefWidth="638.0" style="-fx-background-color: #301c41; -fx-background-radius: 0.25cm;">
<AnchorPane layoutX="81.0" layoutY="95.0" prefHeight="410.0" prefWidth="638.0" style="-fx-background-color: #301c41; -fx-background-radius: 0.25cm;">
<children>
<Label layoutX="34.0" layoutY="35.0" text="Order info" textFill="#e6e8e3">
<font>
<Font name="System Bold" size="15.0" />
</font>
</Label>
<VBox alignment="CENTER_LEFT" layoutX="164.0" layoutY="75.0" prefHeight="226.0" prefWidth="438.0">
<VBox alignment="CENTER_LEFT" layoutX="164.0" layoutY="66.0" prefHeight="226.0" prefWidth="438.0">
<children>
<TextField fx:id="descriptionField" prefHeight="26.0" prefWidth="282.0" style="-fx-background-color: #301c41; -fx-border-color: #e6e8e3; -fx-border-radius: 0.1cm; -fx-text-inner-color: #e6e8e3;">
<VBox.margin>
Expand All @@ -49,6 +49,11 @@
<Insets top="12.0" />
</VBox.margin>
</TextField>
<TextField fx:id="statusField" prefHeight="26.0" prefWidth="282.0" style="-fx-background-color: #301c41; -fx-border-color: #e6e8e3; -fx-border-radius: 0.10cm; -fx-text-inner-color: #e6e8e3;">
<VBox.margin>
<Insets top="12.0" />
</VBox.margin>
</TextField>
<TextField fx:id="priceField" prefHeight="26.0" prefWidth="282.0" style="-fx-background-color: #301c41; -fx-border-color: #e6e8e3; -fx-border-radius: 0.10cm; -fx-text-inner-color: #e6e8e3;">
<VBox.margin>
<Insets top="12.0" />
Expand Down Expand Up @@ -100,6 +105,14 @@
<Font size="14.0" />
</font>
</Label>
<Label prefHeight="35.0" prefWidth="117.0" text="Status" textFill="#e6e8e3">
<padding>
<Insets top="17.0" />
</padding>
<font>
<Font size="14.0" />
</font>
</Label>
<Label prefHeight="40.0" prefWidth="159.0" text="Price" textFill="#e6e8e3">
<padding>
<Insets top="17.0" />
Expand Down

0 comments on commit 78675fd

Please sign in to comment.