Compare commits
14 Commits
06beff62cd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d5c457c9a6 | |||
| 526da66c5f | |||
| a715199bbe | |||
| 2f2719101f | |||
| f9b1b4fc5d | |||
| e582e7ce6b | |||
| 2e7e22c89a | |||
| ccd2323114 | |||
| cf578e17b8 | |||
| 2e3b914d50 | |||
| 1c68112436 | |||
| 906849e4b7 | |||
| 19c889fcd2 | |||
| 47665e3520 |
8
.idea/appInsightsSettings.xml
generated
8
.idea/appInsightsSettings.xml
generated
@@ -22,10 +22,10 @@
|
||||
<InsightsFilterSettings>
|
||||
<option name="connection">
|
||||
<ConnectionSetting>
|
||||
<option name="appId" value="PLACEHOLDER" />
|
||||
<option name="mobileSdkAppId" value="" />
|
||||
<option name="projectId" value="" />
|
||||
<option name="projectNumber" value="" />
|
||||
<option name="appId" value="com.example.pap_teste" />
|
||||
<option name="mobileSdkAppId" value="1:476421715902:android:4147ab5f1cde601e1aebef" />
|
||||
<option name="projectId" value="namesa-429c1" />
|
||||
<option name="projectNumber" value="476421715902" />
|
||||
</ConnectionSetting>
|
||||
</option>
|
||||
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||
|
||||
13
.idea/deviceManager.xml
generated
Normal file
13
.idea/deviceManager.xml
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceTable">
|
||||
<option name="columnSorters">
|
||||
<list>
|
||||
<ColumnSorterState>
|
||||
<option name="column" value="Name" />
|
||||
<option name="order" value="ASCENDING" />
|
||||
</ColumnSorterState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/markdown.xml
generated
Normal file
8
.idea/markdown.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MarkdownSettings">
|
||||
<option name="previewPanelProviderInfo">
|
||||
<ProviderInfo name="Compose (experimental)" className="com.intellij.markdown.compose.preview.ComposePanelProvider" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.google.services)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -37,6 +38,10 @@ dependencies {
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(platform(libs.firebase.bom))
|
||||
implementation("com.google.firebase:firebase-firestore")
|
||||
implementation("com.google.firebase:firebase-auth")
|
||||
implementation(libs.firebase.database)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
|
||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "476421715902",
|
||||
"project_id": "namesa-429c1",
|
||||
"storage_bucket": "namesa-429c1.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:476421715902:android:4147ab5f1cde601e1aebef",
|
||||
"android_client_info": {
|
||||
"package_name": "com.example.pap_teste"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCPz7Pd3tJj3QkF7fV_vudCJythNsyR57k"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
@@ -11,6 +13,19 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Pap_teste">
|
||||
<activity
|
||||
android:name=".AddStaffActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".DetalhesReservasActivity"
|
||||
android:exported="false"
|
||||
android:label="Detalhes das reservas"
|
||||
android:theme="@style/Theme.Pap_teste" />
|
||||
<activity
|
||||
android:name=".GerirMesasActivity"
|
||||
android:exported="false"
|
||||
android:label="Editar mesas"
|
||||
android:theme="@style/Theme.Pap_teste" />
|
||||
<activity
|
||||
android:name=".EstablishmentDashboardActivity"
|
||||
android:exported="false"
|
||||
@@ -66,6 +81,11 @@
|
||||
android:exported="false"
|
||||
android:label="Partilhar reserva"
|
||||
android:theme="@style/Theme.Pap_teste" />
|
||||
<activity
|
||||
android:name=".AccountCreatedActivity"
|
||||
android:exported="false"
|
||||
android:label="Conta criada"
|
||||
android:theme="@style/Theme.Pap_teste" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
/**
|
||||
* Tela de confirmação apresentada logo após a criação de conta.
|
||||
* Exibe os dados básicos e direciona para a área correspondente
|
||||
* (estabelecimento como admin, cliente como cliente).
|
||||
*/
|
||||
public class AccountCreatedActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_account_created);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.accountCreatedRoot), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
TextView txtWelcome = findViewById(R.id.txtWelcome);
|
||||
TextView txtEmail = findViewById(R.id.txtEmail);
|
||||
TextView txtRole = findViewById(R.id.txtRole);
|
||||
Button btnContinue = findViewById(R.id.btnContinuar);
|
||||
Button btnBack = findViewById(R.id.btnVoltar);
|
||||
|
||||
String displayName = getIntent().getStringExtra(MainActivity.EXTRA_DISPLAY_NAME);
|
||||
String email = getIntent().getStringExtra(MainActivity.EXTRA_EMAIL);
|
||||
String accountType = getIntent().getStringExtra(MainActivity.EXTRA_ACCOUNT_TYPE);
|
||||
String role = getIntent().getStringExtra(MainActivity.EXTRA_ROLE);
|
||||
|
||||
txtWelcome.setText(displayName != null ? displayName : "Novo utilizador");
|
||||
txtEmail.setText(email != null ? email : "Email não informado");
|
||||
txtRole.setText(role != null ? role : "CLIENTE");
|
||||
|
||||
btnContinue.setOnClickListener(v -> {
|
||||
boolean isEstablishment = "ESTABELECIMENTO".equalsIgnoreCase(accountType);
|
||||
Intent nextScreen = new Intent(
|
||||
this,
|
||||
isEstablishment ? EstablishmentDashboardActivity.class : ClientDashboardActivity.class
|
||||
);
|
||||
nextScreen.putExtra(MainActivity.EXTRA_ACTION_MODE, MainActivity.AccountAction.CRIAR.name());
|
||||
nextScreen.putExtra(MainActivity.EXTRA_DISPLAY_NAME, displayName);
|
||||
nextScreen.putExtra(MainActivity.EXTRA_EMAIL, email);
|
||||
nextScreen.putExtra(MainActivity.EXTRA_ACCOUNT_TYPE, accountType);
|
||||
nextScreen.putExtra(MainActivity.EXTRA_ROLE, role);
|
||||
startActivity(nextScreen);
|
||||
finish();
|
||||
});
|
||||
|
||||
if (btnBack != null) {
|
||||
btnBack.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
130
app/src/main/java/com/example/pap_teste/AddStaffActivity.java
Normal file
130
app/src/main/java/com/example/pap_teste/AddStaffActivity.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Toast;
|
||||
import java.util.ArrayList;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.InputType;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.example.pap_teste.models.Staff;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
|
||||
public class AddStaffActivity extends AppCompatActivity {
|
||||
|
||||
private Button addButton;
|
||||
private EditText nameEditText;
|
||||
private Spinner zonaSpinner;
|
||||
private Button btnAddZone;
|
||||
private Spinner mesaSpinner;
|
||||
private ArrayList<String> zones;
|
||||
private ArrayList<String> mesas;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayAdapter<String> mesaAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_add_staff);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
addButton = findViewById(R.id.addButton);
|
||||
nameEditText = findViewById(R.id.nammeEditText);
|
||||
zonaSpinner = findViewById(R.id.zonaSpinner);
|
||||
btnAddZone = findViewById(R.id.btnAddZone);
|
||||
mesaSpinner = findViewById(R.id.mesaSpinner);
|
||||
|
||||
zones = new ArrayList<>();
|
||||
zones.add("Sala");
|
||||
zones.add("Esplanada");
|
||||
zones.add("Balcão");
|
||||
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, zones);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
zonaSpinner.setAdapter(adapter);
|
||||
|
||||
mesas = new ArrayList<>();
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
mesas.add("Mesa " + i);
|
||||
}
|
||||
mesaAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, mesas);
|
||||
mesaAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mesaSpinner.setAdapter(mesaAdapter);
|
||||
|
||||
btnAddZone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(AddStaffActivity.this);
|
||||
builder.setTitle("Adicionar Zona");
|
||||
|
||||
final EditText input = new EditText(AddStaffActivity.this);
|
||||
input.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
builder.setView(input);
|
||||
|
||||
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String newZone = input.getText().toString();
|
||||
if (!newZone.isEmpty()) {
|
||||
zones.add(newZone);
|
||||
adapter.notifyDataSetChanged();
|
||||
zonaSpinner.setSelection(zones.size() - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
builder.show();
|
||||
}
|
||||
});
|
||||
|
||||
addButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String name = nameEditText.getText().toString();
|
||||
String zona = "";
|
||||
if (zonaSpinner.getSelectedItem() != null) {
|
||||
zona = zonaSpinner.getSelectedItem().toString();
|
||||
}
|
||||
String mesa = "";
|
||||
if (mesaSpinner.getSelectedItem() != null) {
|
||||
mesa = mesaSpinner.getSelectedItem().toString();
|
||||
}
|
||||
|
||||
if (!name.isEmpty()) {
|
||||
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference("Staff");
|
||||
String uuid = java.util.UUID.randomUUID().toString();
|
||||
Staff staff = new Staff(name, zona, mesa, uuid);
|
||||
databaseReference.child(uuid).setValue(staff);
|
||||
|
||||
Toast.makeText(AddStaffActivity.this, "Staff adicionado com sucesso!", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(AddStaffActivity.this, "Erro: Preencha todos os campos", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class BloqueioHorarioActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class BloqueioHorarioActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class CheckInAntecipadoActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class CheckInAntecipadoActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,14 +26,18 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
|
||||
TextView txtGreeting = findViewById(R.id.txtClientGreeting);
|
||||
TextView txtStatus = findViewById(R.id.txtClientStatus);
|
||||
TextView txtRole = findViewById(R.id.txtClientRole);
|
||||
TextView txtReservationStatus = findViewById(R.id.txtReservationStatus);
|
||||
TextView txtReservationSubtitle = findViewById(R.id.txtReservationSubtitle);
|
||||
Button btnBack = findViewById(R.id.btnVoltar);
|
||||
|
||||
String actionMode = getIntent().getStringExtra(MainActivity.EXTRA_ACTION_MODE);
|
||||
String displayName = getIntent().getStringExtra(MainActivity.EXTRA_DISPLAY_NAME);
|
||||
String role = getIntent().getStringExtra(MainActivity.EXTRA_ROLE);
|
||||
|
||||
boolean isNewAccount = "CRIAR".equalsIgnoreCase(actionMode);
|
||||
txtGreeting.setText(String.format("Olá, %s", displayName != null ? displayName : "convidado"));
|
||||
txtRole.setText(String.format("Função: %s", role != null ? role : "CLIENTE"));
|
||||
txtStatus.setText(isNewAccount
|
||||
? "Conta criada com sucesso! Configure as suas preferências para começarmos."
|
||||
: "Bom tê-lo de volta! Já deixámos tudo pronto para a sua próxima reserva.");
|
||||
@@ -67,11 +71,10 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
btnShare.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, PartilharReservaActivity.class))
|
||||
);
|
||||
}
|
||||
|
||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
||||
// private void showToast(String message) {
|
||||
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
if (btnBack != null) {
|
||||
btnBack.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DetalhesReservasActivity extends AppCompatActivity {
|
||||
|
||||
private final List<ReservaItem> reservas = new ArrayList<>();
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ListView listReservas;
|
||||
private TextView txtInfo;
|
||||
private TextView txtNotas;
|
||||
private TextView txtEstado;
|
||||
private TextView txtMensagem;
|
||||
private int selectedIndex = -1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_detalhes_reservas);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.detalhesReservasRoot), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
bindViews();
|
||||
seedReservasDemo();
|
||||
setupList();
|
||||
setupActions();
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
listReservas = findViewById(R.id.listReservas);
|
||||
txtInfo = findViewById(R.id.txtReservaInfo);
|
||||
txtNotas = findViewById(R.id.txtReservaNotas);
|
||||
txtEstado = findViewById(R.id.txtReservaEstado);
|
||||
txtMensagem = findViewById(R.id.txtMensagemReserva);
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
|
||||
private void seedReservasDemo() {
|
||||
reservas.add(new ReservaItem("Ana Ribeiro", "Mesa 12", "20h00", 4, "Aniversário", "Confirmada"));
|
||||
reservas.add(new ReservaItem("Bruno Costa", "Mesa 03", "21h15", 2, "Preferência por janela", "Pendente"));
|
||||
reservas.add(new ReservaItem("Carla Silva", "Mesa 07", "19h30", 3, "Levar bolo para a mesa", "Pendente"));
|
||||
}
|
||||
|
||||
private void setupList() {
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||
listReservas.setAdapter(adapter);
|
||||
refreshList();
|
||||
|
||||
listReservas.setOnItemClickListener((parent, view, position, id) -> {
|
||||
selectedIndex = position;
|
||||
mostrarDetalhe(reservas.get(position));
|
||||
});
|
||||
}
|
||||
|
||||
private void setupActions() {
|
||||
Button btnConfirmar = findViewById(R.id.btnConfirmarReserva);
|
||||
Button btnCancelar = findViewById(R.id.btnCancelarReserva);
|
||||
|
||||
if (btnConfirmar != null) {
|
||||
btnConfirmar.setOnClickListener(v -> atualizarEstadoSelecionado("Confirmada"));
|
||||
}
|
||||
|
||||
if (btnCancelar != null) {
|
||||
btnCancelar.setOnClickListener(v -> atualizarEstadoSelecionado("Cancelada"));
|
||||
}
|
||||
}
|
||||
|
||||
private void atualizarEstadoSelecionado(String novoEstado) {
|
||||
if (selectedIndex < 0 || selectedIndex >= reservas.size()) {
|
||||
Toast.makeText(this, "Selecione uma reserva para atualizar.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
ReservaItem item = reservas.get(selectedIndex);
|
||||
item.estado = novoEstado;
|
||||
txtMensagem.setText(String.format("Reserva de %s marcada como %s.", item.nomeCliente, novoEstado));
|
||||
mostrarDetalhe(item);
|
||||
refreshList();
|
||||
}
|
||||
|
||||
private void mostrarDetalhe(ReservaItem item) {
|
||||
txtInfo.setText(String.format("%s • %s • %s • %dp", item.nomeCliente, item.mesa, item.hora, item.pessoas));
|
||||
txtNotas.setText(item.notas);
|
||||
txtEstado.setText(String.format("Estado: %s", item.estado));
|
||||
}
|
||||
|
||||
private void refreshList() {
|
||||
adapter.clear();
|
||||
for (ReservaItem item : reservas) {
|
||||
String resumo = String.format("%s - %s (%s) • %s", item.hora, item.mesa, item.estado, item.nomeCliente);
|
||||
adapter.add(resumo);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private static class ReservaItem {
|
||||
String nomeCliente;
|
||||
String mesa;
|
||||
String hora;
|
||||
int pessoas;
|
||||
String notas;
|
||||
String estado;
|
||||
|
||||
ReservaItem(String nomeCliente, String mesa, String hora, int pessoas, String notas, String estado) {
|
||||
this.nomeCliente = nomeCliente;
|
||||
this.mesa = mesa;
|
||||
this.hora = hora;
|
||||
this.pessoas = pessoas;
|
||||
this.notas = notas;
|
||||
this.estado = estado;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,12 +26,15 @@ public class EstablishmentDashboardActivity extends AppCompatActivity {
|
||||
|
||||
TextView txtTitle = findViewById(R.id.txtEstabTitle);
|
||||
TextView txtSubtitle = findViewById(R.id.txtEstabSubtitle);
|
||||
TextView txtRole = findViewById(R.id.txtEstabRole);
|
||||
|
||||
String actionMode = getIntent().getStringExtra(MainActivity.EXTRA_ACTION_MODE);
|
||||
String displayName = getIntent().getStringExtra(MainActivity.EXTRA_DISPLAY_NAME);
|
||||
String role = getIntent().getStringExtra(MainActivity.EXTRA_ROLE);
|
||||
|
||||
boolean isNewAccount = "CRIAR".equalsIgnoreCase(actionMode);
|
||||
txtTitle.setText(displayName != null ? displayName : "Estabelecimento");
|
||||
txtRole.setText(String.format("Função: %s", role != null ? role : "ADMIN"));
|
||||
txtSubtitle.setText(isNewAccount
|
||||
? "Perfil criado. Configure horários, mesas e abra reservas."
|
||||
: "Dashboard operacional. Acompanhe as reservas em tempo real.");
|
||||
@@ -40,6 +43,9 @@ public class EstablishmentDashboardActivity extends AppCompatActivity {
|
||||
Button btnBlockTime = findViewById(R.id.btnCriarBloqueio);
|
||||
Button btnStaff = findViewById(R.id.btnGestaoStaff);
|
||||
Button btnReports = findViewById(R.id.btnVerRelatorios);
|
||||
Button btnGerirMesas = findViewById(R.id.btnGerirMesas);
|
||||
Button btnDetalhesReservas = findViewById(R.id.btnDetalhesReservas);
|
||||
Button btnBack = findViewById(R.id.btnVoltar);
|
||||
|
||||
btnOpenWalkIns.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, ListaEsperaActivity.class))
|
||||
@@ -56,11 +62,18 @@ public class EstablishmentDashboardActivity extends AppCompatActivity {
|
||||
btnReports.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, RelatoriosActivity.class))
|
||||
);
|
||||
}
|
||||
|
||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
||||
// private void showToast(String message) {
|
||||
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
btnGerirMesas.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, GerirMesasActivity.class))
|
||||
);
|
||||
|
||||
btnDetalhesReservas.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, DetalhesReservasActivity.class))
|
||||
);
|
||||
|
||||
if (btnBack != null) {
|
||||
btnBack.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class ExplorarRestaurantesActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class ExplorarRestaurantesActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class FavoritosActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class FavoritosActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
185
app/src/main/java/com/example/pap_teste/GerirMesasActivity.java
Normal file
185
app/src/main/java/com/example/pap_teste/GerirMesasActivity.java
Normal file
@@ -0,0 +1,185 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.example.pap_teste.models.Mesa;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class GerirMesasActivity extends AppCompatActivity {
|
||||
|
||||
private final List<Mesa> mesas = new ArrayList<>();
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ListView listMesas;
|
||||
private EditText inputNumero;
|
||||
private EditText inputCapacidade;
|
||||
private Spinner spinnerEstado;
|
||||
private TextView txtMensagem;
|
||||
private DatabaseReference mDatabase;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_gerir_mesas);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.gerirMesasRoot), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
bindViews();
|
||||
|
||||
mDatabase = FirebaseDatabase.getInstance().getReference("Mesas");
|
||||
|
||||
setupList();
|
||||
setupFormActions();
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
listMesas = findViewById(R.id.listMesas);
|
||||
inputNumero = findViewById(R.id.inputMesaNumero);
|
||||
inputCapacidade = findViewById(R.id.inputMesaCapacidade);
|
||||
spinnerEstado = findViewById(R.id.spinnerEstadoMesa);
|
||||
txtMensagem = findViewById(R.id.txtMensagemMesa);
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
ArrayAdapter<String> estadoAdapter = new ArrayAdapter<>(
|
||||
this,
|
||||
android.R.layout.simple_spinner_dropdown_item,
|
||||
new String[] { "Livre", "Ocupada", "Reservada" });
|
||||
spinnerEstado.setAdapter(estadoAdapter);
|
||||
}
|
||||
|
||||
private void setupList() {
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||
listMesas.setAdapter(adapter);
|
||||
|
||||
mDatabase.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
mesas.clear();
|
||||
adapter.clear();
|
||||
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||
Mesa mesa = postSnapshot.getValue(Mesa.class);
|
||||
if (mesa != null) {
|
||||
mesas.add(mesa);
|
||||
String resumo = String.format("Mesa %02d • %d lugares • %s", mesa.getNumero(),
|
||||
mesa.getCapacidade(), mesa.getEstado());
|
||||
adapter.add(resumo);
|
||||
}
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
Toast.makeText(GerirMesasActivity.this, "Erro ao carregar mesas: " + error.getMessage(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
listMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||
Mesa item = mesas.get(position);
|
||||
inputNumero.setText(String.valueOf(item.getNumero()));
|
||||
inputCapacidade.setText(String.valueOf(item.getCapacidade()));
|
||||
spinnerEstado.setSelection(getEstadoIndex(item.getEstado()));
|
||||
txtMensagem.setText(String.format("Editar mesa %d", item.getNumero()));
|
||||
});
|
||||
}
|
||||
|
||||
private int getEstadoIndex(String estado) {
|
||||
if ("Ocupada".equalsIgnoreCase(estado)) {
|
||||
return 1;
|
||||
}
|
||||
if ("Reservada".equalsIgnoreCase(estado)) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void setupFormActions() {
|
||||
Button btnGuardar = findViewById(R.id.btnGuardarMesa);
|
||||
if (btnGuardar != null) {
|
||||
btnGuardar.setOnClickListener(v -> guardarMesa());
|
||||
}
|
||||
}
|
||||
|
||||
private void guardarMesa() {
|
||||
String numeroStr = inputNumero.getText().toString().trim();
|
||||
String capacidadeStr = inputCapacidade.getText().toString().trim();
|
||||
String estado = (String) spinnerEstado.getSelectedItem();
|
||||
|
||||
if (numeroStr.isEmpty() || capacidadeStr.isEmpty() || estado == null) {
|
||||
Toast.makeText(this, "Preencha número, capacidade e estado.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
int numero;
|
||||
int capacidade;
|
||||
try {
|
||||
numero = Integer.parseInt(numeroStr);
|
||||
capacidade = Integer.parseInt(capacidadeStr);
|
||||
} catch (NumberFormatException e) {
|
||||
Toast.makeText(this, "Use apenas números válidos.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
Mesa existente = findMesa(numero);
|
||||
String mesaId;
|
||||
|
||||
if (existente == null) {
|
||||
mesaId = mDatabase.push().getKey();
|
||||
Mesa novaMesa = new Mesa(mesaId, numero, capacidade, estado);
|
||||
if (mesaId != null) {
|
||||
mDatabase.child(mesaId).setValue(novaMesa);
|
||||
}
|
||||
txtMensagem.setText(String.format("Mesa %d adicionada.", numero));
|
||||
} else {
|
||||
mesaId = existente.getId();
|
||||
existente.setCapacidade(capacidade);
|
||||
existente.setEstado(estado);
|
||||
mDatabase.child(mesaId).setValue(existente);
|
||||
txtMensagem.setText(String.format("Mesa %d atualizada.", numero));
|
||||
}
|
||||
|
||||
// Clearing inputs
|
||||
inputNumero.setText("");
|
||||
inputCapacidade.setText("");
|
||||
}
|
||||
|
||||
private Mesa findMesa(int numero) {
|
||||
for (Mesa item : mesas) {
|
||||
if (item.getNumero() == numero) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,25 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import com.example.pap_teste.models.Mesa;
|
||||
import com.example.pap_teste.models.Staff;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -8,8 +27,29 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GestaoStaffActivity extends AppCompatActivity {
|
||||
|
||||
private final List<Staff> staffList = new ArrayList<>();
|
||||
private ArrayAdapter<String> staffAdapter;
|
||||
private ListView listStaffMesas;
|
||||
|
||||
private Spinner spinnerNomeStaff;
|
||||
private Spinner spinnerMesaStaff;
|
||||
private TextView txtMensagemStaff;
|
||||
|
||||
private DatabaseReference staffRef;
|
||||
private DatabaseReference mesasRef;
|
||||
|
||||
private List<String> staffNames = new ArrayList<>();
|
||||
private List<Mesa> mesasDisponiveis = new ArrayList<>();
|
||||
private ArrayAdapter<String> staffNameAdapter;
|
||||
private ArrayAdapter<String> mesaSpinnerAdapter;
|
||||
|
||||
private FloatingActionButton floatingActionButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -20,7 +60,191 @@ public class GestaoStaffActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
staffRef = FirebaseDatabase.getInstance().getReference("Staff");
|
||||
mesasRef = FirebaseDatabase.getInstance().getReference("Mesas");
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
bindViews();
|
||||
setupMesaSpinner();
|
||||
setupList();
|
||||
setupFormActions();
|
||||
}
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
listStaffMesas = findViewById(R.id.listStaffMesas);
|
||||
spinnerNomeStaff = findViewById(R.id.spinnerNomeStaff);
|
||||
spinnerMesaStaff = findViewById(R.id.spinnerMesaStaff);
|
||||
txtMensagemStaff = findViewById(R.id.txtMensagemStaff);
|
||||
floatingActionButton = findViewById(R.id.floatingActionButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preenche o spinner com uma lista simples de mesas (1–20).
|
||||
* Mais tarde isto pode ser ligado às mesas reais configuradas em "Gerir Mesas".
|
||||
*/
|
||||
private void setupMesaSpinner() {
|
||||
mesaSpinnerAdapter = new ArrayAdapter<>(
|
||||
this,
|
||||
android.R.layout.simple_spinner_dropdown_item);
|
||||
|
||||
staffNameAdapter = new ArrayAdapter<>(
|
||||
this,
|
||||
android.R.layout.simple_spinner_dropdown_item,
|
||||
staffNames);
|
||||
spinnerNomeStaff.setAdapter(staffNameAdapter);
|
||||
|
||||
loadStaffMembers();
|
||||
loadMesas();
|
||||
|
||||
spinnerMesaStaff.setAdapter(mesaSpinnerAdapter);
|
||||
}
|
||||
|
||||
private void loadMesas() {
|
||||
mesasRef.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
mesasDisponiveis.clear();
|
||||
mesaSpinnerAdapter.clear();
|
||||
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||
Mesa mesa = postSnapshot.getValue(Mesa.class);
|
||||
if (mesa != null) {
|
||||
mesasDisponiveis.add(mesa);
|
||||
mesaSpinnerAdapter.add("Mesa " + mesa.getNumero());
|
||||
}
|
||||
}
|
||||
mesaSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
Toast.makeText(GestaoStaffActivity.this, "Erro ao carregar mesas.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupList() {
|
||||
staffAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||
listStaffMesas.setAdapter(staffAdapter);
|
||||
|
||||
listStaffMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||
Staff item = staffList.get(position);
|
||||
// Select staff in spinner
|
||||
int staffIndex = staffNames.indexOf(item.getName());
|
||||
if (staffIndex >= 0) {
|
||||
spinnerNomeStaff.setSelection(staffIndex);
|
||||
}
|
||||
// Select mesa in spinner
|
||||
// Simple string matching for now since Mesa is stored as String in Staff
|
||||
String assignedMesa = item.getMesa();
|
||||
if (assignedMesa != null) {
|
||||
for (int i = 0; i < mesaSpinnerAdapter.getCount(); i++) {
|
||||
if (mesaSpinnerAdapter.getItem(i).equals(assignedMesa)) {
|
||||
spinnerMesaStaff.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
txtMensagemStaff.setText(String.format("A editar: %s", item.getName()));
|
||||
});
|
||||
}
|
||||
|
||||
private void setupFormActions() {
|
||||
Button btnAtribuir = findViewById(R.id.btnAtribuirStaff);
|
||||
if (btnAtribuir != null) {
|
||||
btnAtribuir.setOnClickListener(v -> guardarAtribuicao());
|
||||
}
|
||||
|
||||
if (floatingActionButton != null) {
|
||||
floatingActionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(GestaoStaffActivity.this, AddStaffActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void guardarAtribuicao() {
|
||||
String nome = "";
|
||||
if (spinnerNomeStaff.getSelectedItem() != null) {
|
||||
nome = spinnerNomeStaff.getSelectedItem().toString();
|
||||
}
|
||||
|
||||
if (nome.isEmpty()) {
|
||||
Toast.makeText(this, "Selecione um funcionário.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (spinnerMesaStaff == null || spinnerMesaStaff.getSelectedItem() == null) {
|
||||
Toast.makeText(this, "Selecione uma mesa.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String mesaSelecionada = spinnerMesaStaff.getSelectedItem().toString();
|
||||
|
||||
Staff staffToUpdate = findByNome(nome);
|
||||
if (staffToUpdate != null) {
|
||||
staffToUpdate.setMesa(mesaSelecionada);
|
||||
|
||||
final String finalNome = nome;
|
||||
final String finalMesa = mesaSelecionada;
|
||||
|
||||
staffRef.child(staffToUpdate.getId()).setValue(staffToUpdate)
|
||||
.addOnSuccessListener(aVoid -> {
|
||||
txtMensagemStaff.setText(String.format("%s atribuído à %s.", finalNome, finalMesa));
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
Toast.makeText(this, "Erro ao atualizar: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(this, "Erro: Staff não encontrado.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private Staff findByNome(String nome) {
|
||||
for (Staff item : staffList) {
|
||||
if (item.getName().equalsIgnoreCase(nome)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void loadStaffMembers() {
|
||||
staffRef.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
staffList.clear();
|
||||
staffNames.clear();
|
||||
staffAdapter.clear();
|
||||
|
||||
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
|
||||
Staff staff = postSnapshot.getValue(Staff.class);
|
||||
if (staff != null && staff.getName() != null) {
|
||||
staffList.add(staff);
|
||||
staffNames.add(staff.getName());
|
||||
|
||||
String mesaInfo = staff.getMesa() != null ? staff.getMesa() : "Sem Mesa";
|
||||
String resumo = String.format("%s • %s • %s", staff.getName(), staff.getZona(), mesaInfo);
|
||||
staffAdapter.add(resumo);
|
||||
}
|
||||
}
|
||||
|
||||
staffNameAdapter.notifyDataSetChanged();
|
||||
staffAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
Toast.makeText(GestaoStaffActivity.this, "Erro ao carregar staff.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class ListaEsperaActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class ListaEsperaActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example.pap_teste;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
@@ -15,14 +16,32 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
public static final String EXTRA_ACTION_MODE = "extra_action_mode";
|
||||
public static final String EXTRA_DISPLAY_NAME = "extra_display_name";
|
||||
public static final String EXTRA_EMAIL = "extra_email";
|
||||
public static final String EXTRA_ACCOUNT_TYPE = "extra_account_type";
|
||||
public static final String EXTRA_ROLE = "extra_role";
|
||||
private static final String PREFS_NAME = "pap_prefs";
|
||||
private static final String KEY_HAS_CREATED_ACCOUNT = "has_created_account";
|
||||
|
||||
private enum AccountType {CLIENTE, ESTABELECIMENTO}
|
||||
private enum AccountAction {ENTRAR, CRIAR}
|
||||
public enum AccountType {
|
||||
CLIENTE, ESTABELECIMENTO
|
||||
}
|
||||
|
||||
public enum AccountAction {
|
||||
ENTRAR, CRIAR
|
||||
}
|
||||
|
||||
private AccountType selectedAccountType = AccountType.CLIENTE;
|
||||
private AccountAction selectedAccountAction = AccountAction.ENTRAR;
|
||||
@@ -35,6 +54,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
private EditText inputName;
|
||||
private EditText inputEmail;
|
||||
private EditText inputPassword;
|
||||
private EditText inputOwnerPhone;
|
||||
private EditText inputEstablishmentName;
|
||||
private EditText inputEstablishmentEmail;
|
||||
private EditText inputEstablishmentPhone;
|
||||
private boolean hasCreatedAccount;
|
||||
private FirebaseAuth firebaseAuth;
|
||||
private DatabaseReference databaseReference;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -47,6 +73,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
FirebaseApp.initializeApp(this);
|
||||
firebaseAuth = FirebaseAuth.getInstance();
|
||||
databaseReference = FirebaseDatabase.getInstance().getReference();
|
||||
|
||||
bindViews();
|
||||
setupTypeToggle();
|
||||
setupActionToggle();
|
||||
@@ -62,6 +92,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
inputName = findViewById(R.id.inputName);
|
||||
inputEmail = findViewById(R.id.inputEmail);
|
||||
inputPassword = findViewById(R.id.inputPassword);
|
||||
inputOwnerPhone = findViewById(R.id.inputOwnerPhone);
|
||||
inputEstablishmentName = findViewById(R.id.inputEstablishmentName);
|
||||
inputEstablishmentEmail = findViewById(R.id.inputEstablishmentEmail);
|
||||
inputEstablishmentPhone = findViewById(R.id.inputEstablishmentPhone);
|
||||
}
|
||||
|
||||
private void setupTypeToggle() {
|
||||
@@ -96,6 +130,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private void updateTypeButtons() {
|
||||
setSelectedState(btnCliente, selectedAccountType == AccountType.CLIENTE);
|
||||
setSelectedState(btnEstabelecimento, selectedAccountType == AccountType.ESTABELECIMENTO);
|
||||
updateInputVisibility();
|
||||
}
|
||||
|
||||
private void updateActionButtons() {
|
||||
@@ -105,44 +140,90 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setSelectedState(Button button, boolean isSelected) {
|
||||
int selectedTextColor = Color.WHITE;
|
||||
int defaultTextColor = Color.parseColor("#231F1F");
|
||||
button.setBackgroundResource(isSelected ? R.drawable.tab_selected : R.drawable.tab_unselected);
|
||||
button.setTextColor(isSelected ? Color.WHITE : Color.parseColor("#00001A"));
|
||||
button.setTextColor(isSelected ? selectedTextColor : defaultTextColor);
|
||||
}
|
||||
|
||||
private void updatePrimaryActionState() {
|
||||
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
||||
btnPrimaryAction.setText(creatingAccount ? "Criar Conta" : "Entrar");
|
||||
updateInputVisibility();
|
||||
}
|
||||
|
||||
private void updateInputVisibility() {
|
||||
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
||||
boolean isEstablishment = selectedAccountType == AccountType.ESTABELECIMENTO;
|
||||
|
||||
inputName.setHint(isEstablishment ? "Nome do proprietário" : "O seu nome");
|
||||
inputEmail.setHint(isEstablishment ? "Email do proprietário" : "Email");
|
||||
|
||||
inputName.setVisibility(creatingAccount ? View.VISIBLE : View.GONE);
|
||||
inputOwnerPhone.setVisibility(creatingAccount && isEstablishment ? View.VISIBLE : View.GONE);
|
||||
inputEstablishmentName.setVisibility(creatingAccount && isEstablishment ? View.VISIBLE : View.GONE);
|
||||
inputEstablishmentEmail.setVisibility(creatingAccount && isEstablishment ? View.VISIBLE : View.GONE);
|
||||
inputEstablishmentPhone.setVisibility(creatingAccount && isEstablishment ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void handlePrimaryAction() {
|
||||
String email = inputEmail.getText().toString().trim();
|
||||
String password = inputPassword.getText().toString().trim();
|
||||
String providedName = inputName.getText().toString().trim();
|
||||
String ownerPhone = inputOwnerPhone.getText().toString().trim();
|
||||
String establishmentName = inputEstablishmentName.getText().toString().trim();
|
||||
String establishmentEmail = inputEstablishmentEmail.getText().toString().trim();
|
||||
String establishmentPhone = inputEstablishmentPhone.getText().toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(email) || TextUtils.isEmpty(password)) {
|
||||
Toast.makeText(this, "Preencha email e palavra-passe.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedAccountAction == AccountAction.CRIAR && TextUtils.isEmpty(providedName)) {
|
||||
Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show();
|
||||
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
||||
|
||||
if (creatingAccount && !isValidPassword(password)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String fallbackName = !TextUtils.isEmpty(providedName) ? providedName : deriveNameFromEmail(email);
|
||||
Intent nextScreen;
|
||||
if (creatingAccount) {
|
||||
if (selectedAccountType == AccountType.CLIENTE && TextUtils.isEmpty(providedName)) {
|
||||
Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedAccountType == AccountType.CLIENTE) {
|
||||
nextScreen = new Intent(this, ClientDashboardActivity.class);
|
||||
} else {
|
||||
nextScreen = new Intent(this, EstablishmentDashboardActivity.class);
|
||||
if (selectedAccountType == AccountType.ESTABELECIMENTO) {
|
||||
boolean missingOwner = TextUtils.isEmpty(providedName) || TextUtils.isEmpty(ownerPhone);
|
||||
boolean missingEstablishment = TextUtils.isEmpty(establishmentName)
|
||||
|| TextUtils.isEmpty(establishmentEmail)
|
||||
|| TextUtils.isEmpty(establishmentPhone);
|
||||
|
||||
if (missingOwner || missingEstablishment) {
|
||||
Toast.makeText(this, "Preencha os dados do proprietário e do estabelecimento.", Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
||||
nextScreen.putExtra(EXTRA_DISPLAY_NAME, fallbackName);
|
||||
nextScreen.putExtra(EXTRA_EMAIL, email);
|
||||
startActivity(nextScreen);
|
||||
String fallbackName = !TextUtils.isEmpty(providedName) ? providedName : deriveNameFromEmail(email);
|
||||
String resolvedRole = getRoleForSelectedType();
|
||||
|
||||
if (creatingAccount) {
|
||||
createAccountInFirebase(
|
||||
email,
|
||||
password,
|
||||
providedName,
|
||||
ownerPhone,
|
||||
establishmentName,
|
||||
establishmentEmail,
|
||||
establishmentPhone,
|
||||
fallbackName,
|
||||
resolvedRole);
|
||||
return;
|
||||
}
|
||||
|
||||
signInExistingAccount(email, password, fallbackName, resolvedRole);
|
||||
}
|
||||
|
||||
private String deriveNameFromEmail(String email) {
|
||||
@@ -157,4 +238,220 @@ public class MainActivity extends AppCompatActivity {
|
||||
String rest = candidate.length() > 1 ? candidate.substring(1) : "";
|
||||
return firstLetter + rest;
|
||||
}
|
||||
|
||||
private void markAccountCreated() {
|
||||
hasCreatedAccount = true;
|
||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
prefs.edit().putBoolean(KEY_HAS_CREATED_ACCOUNT, true).apply();
|
||||
}
|
||||
|
||||
private String getRoleForSelectedType() {
|
||||
return selectedAccountType == AccountType.ESTABELECIMENTO ? "ADMIN" : "CLIENTE";
|
||||
}
|
||||
|
||||
private String buildDocumentId(String email) {
|
||||
return email.replace(".", "_").replace("@", "_at_");
|
||||
}
|
||||
|
||||
private boolean ensureFirebaseReady() {
|
||||
boolean ready = firebaseAuth != null && databaseReference != null;
|
||||
if (!ready) {
|
||||
Toast.makeText(this, "Ligue-se ao Firebase para continuar.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
private void signInExistingAccount(String email, String password, String fallbackName, String resolvedRole) {
|
||||
if (!ensureFirebaseReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
firebaseAuth.signInWithEmailAndPassword(email, password)
|
||||
.addOnSuccessListener(authResult -> fetchAccountAndNavigate(email, fallbackName, resolvedRole))
|
||||
.addOnFailureListener(e -> {
|
||||
android.util.Log.e("LoginError", "SignIn failed", e);
|
||||
Toast.makeText(this, "Não foi possível iniciar sessão: " + e.getMessage(), Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
|
||||
private void createAccountInFirebase(
|
||||
String email,
|
||||
String password,
|
||||
String providedName,
|
||||
String ownerPhone,
|
||||
String establishmentName,
|
||||
String establishmentEmail,
|
||||
String establishmentPhone,
|
||||
String fallbackName,
|
||||
String resolvedRole) {
|
||||
if (!ensureFirebaseReady()) {
|
||||
return;
|
||||
}
|
||||
|
||||
firebaseAuth.createUserWithEmailAndPassword(email, password)
|
||||
.addOnSuccessListener(result -> {
|
||||
if (!hasCreatedAccount) {
|
||||
markAccountCreated();
|
||||
}
|
||||
String finalDisplayName = selectedAccountType == AccountType.ESTABELECIMENTO
|
||||
&& !TextUtils.isEmpty(establishmentName)
|
||||
? establishmentName
|
||||
: fallbackName;
|
||||
String uid = result.getUser() != null ? result.getUser().getUid() : null;
|
||||
|
||||
persistAccountInFirebase(
|
||||
email,
|
||||
providedName,
|
||||
resolvedRole,
|
||||
ownerPhone,
|
||||
establishmentName,
|
||||
establishmentEmail,
|
||||
establishmentPhone,
|
||||
uid,
|
||||
() -> {
|
||||
Toast.makeText(this, "Conta criada com sucesso! Carregue em Entrar.", Toast.LENGTH_LONG)
|
||||
.show();
|
||||
selectedAccountAction = AccountAction.ENTRAR;
|
||||
updateActionButtons();
|
||||
});
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
android.util.Log.e("LoginError", "CreateUser failed", e);
|
||||
Toast.makeText(this, "Falha ao criar conta: " + e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
}
|
||||
|
||||
private void fetchAccountAndNavigate(String email, String fallbackName, String resolvedRole) {
|
||||
if (databaseReference == null) {
|
||||
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
||||
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||
return;
|
||||
}
|
||||
|
||||
String documentId = buildDocumentId(email);
|
||||
databaseReference.child("users").child(documentId).get().addOnCompleteListener(task -> {
|
||||
if (!task.isSuccessful()) {
|
||||
android.util.Log.e("LoginError", "Database check failed", task.getException());
|
||||
Toast.makeText(this, "Falha ao validar perfil na cloud. A entrar em modo básico.", Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||
return;
|
||||
}
|
||||
|
||||
DataSnapshot snapshot = task.getResult();
|
||||
if (snapshot == null || !snapshot.exists()) {
|
||||
Toast.makeText(this, "Conta sem perfil na cloud. A entrar em modo básico.", Toast.LENGTH_SHORT).show();
|
||||
navigateToDashboard(email, fallbackName, resolvedRole);
|
||||
return;
|
||||
}
|
||||
|
||||
String accountTypeInFirebase = snapshot.child("accountType").getValue(String.class);
|
||||
if (accountTypeInFirebase != null
|
||||
&& !accountTypeInFirebase.equalsIgnoreCase(selectedAccountType.name())) {
|
||||
Toast.makeText(this, "Tipo de conta não corresponde ao registo no Firebase.", Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
String displayNameFromDb = snapshot.child("displayName").getValue(String.class);
|
||||
String establishmentName = snapshot.child("establishmentName").getValue(String.class);
|
||||
String ownerName = snapshot.child("ownerName").getValue(String.class);
|
||||
String roleFromDb = snapshot.child("role").getValue(String.class);
|
||||
|
||||
String finalDisplayName = !TextUtils.isEmpty(establishmentName)
|
||||
? establishmentName
|
||||
: !TextUtils.isEmpty(displayNameFromDb) ? displayNameFromDb
|
||||
: !TextUtils.isEmpty(ownerName) ? ownerName
|
||||
: fallbackName;
|
||||
|
||||
String finalRole = !TextUtils.isEmpty(roleFromDb) ? roleFromDb : resolvedRole;
|
||||
navigateToDashboard(email, finalDisplayName, finalRole);
|
||||
});
|
||||
}
|
||||
|
||||
private void navigateToDashboard(String email, String displayName, String role) {
|
||||
Intent nextScreen = selectedAccountType == AccountType.CLIENTE
|
||||
? new Intent(this, ClientDashboardActivity.class)
|
||||
: new Intent(this, EstablishmentDashboardActivity.class);
|
||||
|
||||
nextScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
||||
nextScreen.putExtra(EXTRA_DISPLAY_NAME, displayName);
|
||||
nextScreen.putExtra(EXTRA_EMAIL, email);
|
||||
nextScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
||||
nextScreen.putExtra(EXTRA_ROLE, role);
|
||||
startActivity(nextScreen);
|
||||
}
|
||||
|
||||
private void persistAccountInFirebase(
|
||||
String ownerEmail,
|
||||
String ownerName,
|
||||
String role,
|
||||
String ownerPhone,
|
||||
String establishmentName,
|
||||
String establishmentEmail,
|
||||
String establishmentPhone,
|
||||
String uid,
|
||||
Runnable onSuccess) {
|
||||
if (databaseReference == null) {
|
||||
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String documentId = buildDocumentId(ownerEmail);
|
||||
Map<String, Object> payload = new HashMap<>();
|
||||
if (!TextUtils.isEmpty(uid)) {
|
||||
payload.put("uid", uid);
|
||||
}
|
||||
payload.put("email", ownerEmail);
|
||||
payload.put("displayName", ownerName);
|
||||
payload.put("role", role);
|
||||
payload.put("accountType", selectedAccountType.name());
|
||||
payload.put("createdAt", System.currentTimeMillis());
|
||||
|
||||
if (selectedAccountType == AccountType.ESTABELECIMENTO) {
|
||||
payload.put("ownerName", ownerName);
|
||||
payload.put("ownerEmail", ownerEmail);
|
||||
payload.put("ownerPhone", ownerPhone);
|
||||
payload.put("establishmentName", establishmentName);
|
||||
payload.put("establishmentEmail", establishmentEmail);
|
||||
payload.put("establishmentPhone", establishmentPhone);
|
||||
}
|
||||
|
||||
databaseReference.child("users").child(documentId).updateChildren(payload)
|
||||
.addOnSuccessListener(unused -> {
|
||||
Toast.makeText(this, "Conta guardada na cloud.", Toast.LENGTH_SHORT).show();
|
||||
if (onSuccess != null) {
|
||||
onSuccess.run();
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(
|
||||
e -> Toast.makeText(this, "Não foi possível guardar na cloud.", Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
private boolean isValidPassword(String password) {
|
||||
if (password.length() < 6) {
|
||||
Toast.makeText(this, "A palavra-passe deve ter pelo menos 6 caracteres.", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
boolean hasLower = false;
|
||||
boolean hasDigit = false;
|
||||
boolean hasSpecial = false;
|
||||
|
||||
for (char c : password.toCharArray()) {
|
||||
if (Character.isLowerCase(c))
|
||||
hasLower = true;
|
||||
else if (Character.isDigit(c))
|
||||
hasDigit = true;
|
||||
else if (!Character.isLetterOrDigit(c))
|
||||
hasSpecial = true;
|
||||
}
|
||||
|
||||
if (!hasLower || !hasDigit || !hasSpecial) {
|
||||
Toast.makeText(this, "A palavra-passe deve conter minúsculas, números e símbolos.", Toast.LENGTH_LONG)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class NovaReservaActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,15 @@ public class NovaReservaActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class PartilharReservaActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,10 @@ public class PartilharReservaActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.widget.Button;
|
||||
|
||||
public class RelatoriosActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +22,10 @@ public class RelatoriosActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
Button back = findViewById(R.id.btnVoltar);
|
||||
if (back != null) {
|
||||
back.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
56
app/src/main/java/com/example/pap_teste/models/Mesa.java
Normal file
56
app/src/main/java/com/example/pap_teste/models/Mesa.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.example.pap_teste.models;
|
||||
|
||||
public class Mesa {
|
||||
private String id;
|
||||
private int numero;
|
||||
private int capacidade;
|
||||
private String estado;
|
||||
|
||||
public Mesa() {
|
||||
// Default constructor required for calls to DataSnapshot.getValue(Mesa.class)
|
||||
}
|
||||
|
||||
public Mesa(String id, int numero, int capacidade, String estado) {
|
||||
this.id = id;
|
||||
this.numero = numero;
|
||||
this.capacidade = capacidade;
|
||||
this.estado = estado;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public void setNumero(int numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public int getCapacidade() {
|
||||
return capacidade;
|
||||
}
|
||||
|
||||
public void setCapacidade(int capacidade) {
|
||||
this.capacidade = capacidade;
|
||||
}
|
||||
|
||||
public String getEstado() {
|
||||
return estado;
|
||||
}
|
||||
|
||||
public void setEstado(String estado) {
|
||||
this.estado = estado;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Mesa " + numero;
|
||||
}
|
||||
}
|
||||
51
app/src/main/java/com/example/pap_teste/models/Staff.java
Normal file
51
app/src/main/java/com/example/pap_teste/models/Staff.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.example.pap_teste.models;
|
||||
|
||||
public class Staff {
|
||||
private String name;
|
||||
private String zona;
|
||||
private String mesa;
|
||||
|
||||
private String id;
|
||||
|
||||
public Staff(String name, String zona, String mesa, String id) {
|
||||
this.name = name;
|
||||
this.zona = zona;
|
||||
this.mesa = mesa;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Staff() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getZona() {
|
||||
return zona;
|
||||
}
|
||||
|
||||
public void setZona(String zona) {
|
||||
this.zona = zona;
|
||||
}
|
||||
|
||||
public String getMesa() {
|
||||
return mesa;
|
||||
}
|
||||
|
||||
public void setMesa(String mesa) {
|
||||
this.mesa = mesa;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -16,3 +16,15 @@
|
||||
</ripple>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#00001A" />
|
||||
<solid android:color="#8BC34A" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
111
app/src/main/res/layout/activity_account_created.xml
Normal file
111
app/src/main/res/layout/activity_account_created.xml
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/accountCreatedRoot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".AccountCreatedActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardAccountCreated"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:cardBackgroundColor="#FFFFFF"
|
||||
app:cardCornerRadius="18dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtCongrats"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Conta criada!"
|
||||
android:textColor="#000"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Nome"
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="email@example.com"
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtRoleLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Função atribuída:"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtRole"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="ADMIN"
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtInstructions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Vamos configurar o seu espaço. Pode aceder à sua área agora."
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnContinuar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:text="Ir para a minha área"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
73
app/src/main/res/layout/activity_add_staff.xml
Normal file
73
app/src/main/res/layout/activity_add_staff.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".AddStaffActivity">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/nammeEditText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ems="10"
|
||||
android:hint="Name"
|
||||
android:inputType="text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/zoneLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/nammeEditText"
|
||||
app:layout_constraintStart_toStartOf="@+id/nammeEditText"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nammeEditText">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/zonaSpinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="48dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAddZone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mesaLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@+id/zoneLayout"
|
||||
app:layout_constraintStart_toStartOf="@+id/zoneLayout"
|
||||
app:layout_constraintTop_toBottomOf="@+id/zoneLayout">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/mesaSpinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="48dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Button"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".BloqueioHorarioActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloBloqueio"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".CheckInAntecipadoActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloCheckin"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,23 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".ClientDashboardActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/clientScroll"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
@@ -42,6 +53,16 @@
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtClientRole"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Função: CLIENTE"
|
||||
android:textColor="#0066CC"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
168
app/src/main/res/layout/activity_detalhes_reservas.xml
Normal file
168
app/src/main/res/layout/activity_detalhes_reservas.xml
Normal file
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/detalhesReservasRoot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".DetalhesReservasActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloDetalhes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Detalhes das reservas"
|
||||
android:textColor="#000"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
android:layout_marginTop="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtDescricaoDetalhes"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Selecione uma reserva para ver os detalhes e atualizar o estado."
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTituloDetalhes" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listReservas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:divider="#E0E0E0"
|
||||
android:dividerHeight="1dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtDescricaoDetalhes"
|
||||
app:layout_constraintBottom_toTopOf="@id/cardDetalhes"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardDetalhes"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:cardBackgroundColor="#FFFFFF"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reserva selecionada"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtReservaInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Selecione uma reserva"
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtReservaNotas"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text=""
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtReservaEstado"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Estado:"
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnConfirmarReserva"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:text="Confirmar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCancelarReserva"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_light_border"
|
||||
android:text="Cancelar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#00001A" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtMensagemReserva"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text=""
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="13sp" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,22 @@
|
||||
android:background="#F2F2F2"
|
||||
tools:context=".EstablishmentDashboardActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
@@ -41,6 +52,16 @@
|
||||
android:textColor="#5F5F5F"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtEstabRole"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="Função: ADMIN"
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -240,6 +261,26 @@
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#00001A" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGerirMesas"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/btn_light_border"
|
||||
android:text="Editar mesas"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#00001A" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDetalhesReservas"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="@drawable/btn_light_border"
|
||||
android:text="Detalhes das reservas"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#00001A" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCriarBloqueio"
|
||||
android:layout_width="match_parent"
|
||||
@@ -307,3 +348,6 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".ExplorarRestaurantesActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloExplorar"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".FavoritosActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloFavoritos"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
155
app/src/main/res/layout/activity_gerir_mesas.xml
Normal file
155
app/src/main/res/layout/activity_gerir_mesas.xml
Normal file
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/gerirMesasRoot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".GerirMesasActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloGerirMesas"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Editar mesas"
|
||||
android:textColor="#000"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
android:layout_marginTop="24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtDescricaoGerirMesas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="Atualize rapidamente as mesas disponíveis, capacidade e estado."
|
||||
android:textColor="#4D4D4D"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTituloGerirMesas" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/formMesas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="@drawable/btn_light"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtDescricaoGerirMesas">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Editar ou adicionar mesa"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputMesaNumero"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Número da mesa"
|
||||
android:inputType="number"
|
||||
android:padding="12dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputMesaCapacidade"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Capacidade (lugares)"
|
||||
android:inputType="number"
|
||||
android:padding="12dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerEstadoMesa"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGuardarMesa"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:text="Guardar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtMensagemMesa"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text=""
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtListaTitulo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Mesas registadas"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/formMesas" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listMesas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:divider="#E0E0E0"
|
||||
android:dividerHeight="1dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtListaTitulo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".GestaoStaffActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloGestaoStaff"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -34,6 +45,108 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/formStaff"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:background="@drawable/btn_light"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtDescricaoGestaoStaff">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Atribuir funcionário a uma mesa"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerNomeStaff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:padding="0dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerMesaStaff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAtribuirStaff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:text="Guardar atribuição"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#FFFFFF" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtMensagemStaff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text=""
|
||||
android:textColor="#2E7D32"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtListaStaffTitulo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="Funcionários e mesas"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/formStaff" />
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listStaffMesas"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:divider="#E0E0E0"
|
||||
android:dividerHeight="1dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtListaStaffTitulo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" >
|
||||
|
||||
|
||||
</ListView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/floatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:clickable="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".ListaEsperaActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloListaEspera"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,164 +8,224 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoNaMesa"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/na_mesa"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.494"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.065" />
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="624dp"
|
||||
android:text="NaMesa"
|
||||
android:textColor="#000"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.488"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/logoNaMesa" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtSub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sistema de Reserva de Mesas"
|
||||
android:textColor="#777"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTitle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtSub"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="3dp">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:padding="3dp">
|
||||
<ImageView
|
||||
android:id="@+id/logoNaMesa"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/na_mesa"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.494"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.065" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCliente"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="Cliente"
|
||||
android:textSize="5pt"
|
||||
android:background="@drawable/tab_selected"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEstabelecimento"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:text="Estabelecimento"
|
||||
android:textSize="5pt"
|
||||
android:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEntrar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="Entrar"
|
||||
android:textSize="5pt"
|
||||
android:background="@drawable/tab_selected"
|
||||
android:textAllCaps="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCriarConta"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="Criar Conta"
|
||||
android:textSize="5pt"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
<TextView
|
||||
android:id="@+id/txtTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:inputType="textPersonName"
|
||||
android:hint="O seu nome"
|
||||
android:background="@drawable/input_bg"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone"/>
|
||||
android:layout_marginBottom="624dp"
|
||||
android:text="NaMesa"
|
||||
android:textColor="#000"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.488"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/logoNaMesa" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:padding="12dp" />
|
||||
<TextView
|
||||
android:id="@+id/txtSub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="Sistema de Reserva de Mesas"
|
||||
android:textColor="#777"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTitle" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:inputType="textPassword"
|
||||
android:hint="Palavra-passe"
|
||||
android:background="@drawable/input_bg"
|
||||
android:padding="12dp"/>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="3dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtSub">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCliente"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_light"
|
||||
android:text="Cliente"
|
||||
android:textAllCaps="false"
|
||||
android:textColorLink="#231F1F"
|
||||
android:textSize="5pt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEstabelecimento"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:backgroundTint="@color/black"
|
||||
android:text="Estabelecimento"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="5pt" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEntrar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_selected"
|
||||
android:text="Entrar"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="5pt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCriarConta"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:text="Criar Conta"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="5pt" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="O seu nome"
|
||||
android:inputType="textPersonName"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:padding="12dp"
|
||||
android:text="EstabelecimentoPap@gmail.com" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputOwnerPhone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Telefone do proprietário"
|
||||
android:inputType="phone"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEstablishmentName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Nome do estabelecimento"
|
||||
android:inputType="textCapWords"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEstablishmentEmail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Email do estabelecimento"
|
||||
android:inputType="textEmailAddress"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEstablishmentPhone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Telefone do estabelecimento"
|
||||
android:inputType="phone"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Palavra-passe"
|
||||
android:inputType="textPassword"
|
||||
android:padding="12dp"
|
||||
android:text="PaP@P.1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnFinalCriarConta"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:padding="12dp"
|
||||
android:text="Entrar"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#FFF" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnFinalCriarConta"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Entrar"
|
||||
android:textColor="#FFF"
|
||||
android:background="@drawable/btn_primary"
|
||||
android:textAllCaps="false"
|
||||
android:padding="12dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".NovaReservaActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloNovaReserva"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".PartilharReservaActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloPartilhar"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".RelatoriosActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnVoltar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Voltar"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTituloRelatorios"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -16,7 +27,7 @@
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnVoltar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="32dp" />
|
||||
@@ -37,3 +48,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="my_light_primary">#BE1F13</color>
|
||||
</resources>
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Pap_teste" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
<item name="colorPrimary">#958787</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Pap_teste" parent="Base.Theme.Pap_teste" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.google.services) apply false
|
||||
}
|
||||
@@ -18,4 +18,14 @@ android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.nonTransitiveRClass=true
|
||||
android.defaults.buildfeatures.resvalues=true
|
||||
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
||||
android.enableAppCompileTimeRClass=false
|
||||
android.usesSdkInManifest.disallowed=false
|
||||
android.uniquePackageNames=false
|
||||
android.dependency.useConstraints=true
|
||||
android.r8.strictFullModeForKeepRules=false
|
||||
android.r8.optimizedResourceShrinking=false
|
||||
android.builtInKotlin=false
|
||||
android.newDsl=false
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.13.1"
|
||||
agp = "9.0.1"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.3.0"
|
||||
espressoCore = "3.7.0"
|
||||
@@ -8,6 +8,9 @@ appcompat = "1.7.1"
|
||||
material = "1.13.0"
|
||||
activity = "1.11.0"
|
||||
constraintlayout = "2.2.1"
|
||||
firebaseBom = "33.7.0"
|
||||
googleServices = "4.4.2"
|
||||
firebaseDatabase = "22.0.1"
|
||||
|
||||
[libraries]
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
@@ -18,7 +21,10 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
|
||||
firebase-database = { group = "com.google.firebase", name = "firebase-database", version.ref = "firebaseDatabase" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
|
||||
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Tue Nov 25 09:03:54 WET 2025
|
||||
#Tue Jan 20 14:11:23 WET 2026
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Reference in New Issue
Block a user