Compare commits
2 Commits
06beff62cd
...
19c889fcd2
| Author | SHA1 | Date | |
|---|---|---|---|
| 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" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.google.services)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -37,6 +38,9 @@ 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")
|
||||
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"
|
||||
}
|
||||
@@ -11,6 +11,16 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Pap_teste">
|
||||
<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 +76,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,6 +71,10 @@ public class ClientDashboardActivity extends AppCompatActivity {
|
||||
btnShare.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, PartilharReservaActivity.class))
|
||||
);
|
||||
|
||||
if (btnBack != null) {
|
||||
btnBack.setOnClickListener(v -> finish());
|
||||
}
|
||||
}
|
||||
|
||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
||||
|
||||
@@ -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,6 +62,18 @@ public class EstablishmentDashboardActivity extends AppCompatActivity {
|
||||
btnReports.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, RelatoriosActivity.class))
|
||||
);
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// Mantemos este método caso seja útil no futuro para feedback rápido.
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
178
app/src/main/java/com/example/pap_teste/GerirMesasActivity.java
Normal file
178
app/src/main/java/com/example/pap_teste/GerirMesasActivity.java
Normal file
@@ -0,0 +1,178 @@
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GerirMesasActivity extends AppCompatActivity {
|
||||
|
||||
private final List<MesaItem> mesas = new ArrayList<>();
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ListView listMesas;
|
||||
private EditText inputNumero;
|
||||
private EditText inputCapacidade;
|
||||
private Spinner spinnerEstado;
|
||||
private TextView txtMensagem;
|
||||
|
||||
@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();
|
||||
seedMesasDemo();
|
||||
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 seedMesasDemo() {
|
||||
mesas.add(new MesaItem(1, 4, "Livre"));
|
||||
mesas.add(new MesaItem(2, 2, "Reservada"));
|
||||
mesas.add(new MesaItem(3, 6, "Ocupada"));
|
||||
mesas.add(new MesaItem(4, 4, "Livre"));
|
||||
}
|
||||
|
||||
private void setupList() {
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||
listMesas.setAdapter(adapter);
|
||||
refreshList();
|
||||
|
||||
listMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||
MesaItem item = mesas.get(position);
|
||||
inputNumero.setText(String.valueOf(item.numero));
|
||||
inputCapacidade.setText(String.valueOf(item.capacidade));
|
||||
spinnerEstado.setSelection(getEstadoIndex(item.estado));
|
||||
txtMensagem.setText(String.format("Editar mesa %d", item.numero));
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
MesaItem existente = findMesa(numero);
|
||||
if (existente == null) {
|
||||
mesas.add(new MesaItem(numero, capacidade, estado));
|
||||
txtMensagem.setText(String.format("Mesa %d adicionada/atualizada.", numero));
|
||||
} else {
|
||||
existente.capacidade = capacidade;
|
||||
existente.estado = estado;
|
||||
txtMensagem.setText(String.format("Mesa %d atualizada.", numero));
|
||||
}
|
||||
|
||||
refreshList();
|
||||
}
|
||||
|
||||
private MesaItem findMesa(int numero) {
|
||||
for (MesaItem item : mesas) {
|
||||
if (item.numero == numero) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void refreshList() {
|
||||
adapter.clear();
|
||||
for (MesaItem item : mesas) {
|
||||
String resumo = String.format("Mesa %02d • %d lugares • %s", item.numero, item.capacidade, item.estado);
|
||||
adapter.add(resumo);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private static class MesaItem {
|
||||
int numero;
|
||||
int capacidade;
|
||||
String estado;
|
||||
|
||||
MesaItem(int numero, int capacidade, String estado) {
|
||||
this.numero = numero;
|
||||
this.capacidade = capacidade;
|
||||
this.estado = estado;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
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;
|
||||
@@ -8,8 +15,18 @@ 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<StaffAssignment> staffAssignments = new ArrayList<>();
|
||||
private ArrayAdapter<String> staffAdapter;
|
||||
private ListView listStaffMesas;
|
||||
private EditText inputNomeStaff;
|
||||
private Spinner spinnerMesaStaff;
|
||||
private TextView txtMensagemStaff;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -20,7 +37,121 @@ public class GestaoStaffActivity 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());
|
||||
}
|
||||
|
||||
bindViews();
|
||||
setupMesaSpinner();
|
||||
setupList();
|
||||
setupFormActions();
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
listStaffMesas = findViewById(R.id.listStaffMesas);
|
||||
inputNomeStaff = findViewById(R.id.inputNomeStaff);
|
||||
spinnerMesaStaff = findViewById(R.id.spinnerMesaStaff);
|
||||
txtMensagemStaff = findViewById(R.id.txtMensagemStaff);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
ArrayAdapter<String> mesaAdapter = new ArrayAdapter<>(
|
||||
this,
|
||||
android.R.layout.simple_spinner_dropdown_item
|
||||
);
|
||||
|
||||
for (int i = 1; i <= 20; i++) {
|
||||
mesaAdapter.add(String.format("Mesa %02d", i));
|
||||
}
|
||||
|
||||
spinnerMesaStaff.setAdapter(mesaAdapter);
|
||||
}
|
||||
|
||||
private void setupList() {
|
||||
staffAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_activated_1);
|
||||
listStaffMesas.setAdapter(staffAdapter);
|
||||
refreshList();
|
||||
|
||||
listStaffMesas.setOnItemClickListener((parent, view, position, id) -> {
|
||||
StaffAssignment item = staffAssignments.get(position);
|
||||
inputNomeStaff.setText(item.nome);
|
||||
int index = Math.max(0, Math.min(spinnerMesaStaff.getCount() - 1, item.mesaNumero - 1));
|
||||
spinnerMesaStaff.setSelection(index);
|
||||
txtMensagemStaff.setText(String.format("A editar: %s (Mesa %02d)", item.nome, item.mesaNumero));
|
||||
});
|
||||
}
|
||||
|
||||
private void setupFormActions() {
|
||||
Button btnAtribuir = findViewById(R.id.btnAtribuirStaff);
|
||||
if (btnAtribuir != null) {
|
||||
btnAtribuir.setOnClickListener(v -> guardarAtribuicao());
|
||||
}
|
||||
}
|
||||
|
||||
private void guardarAtribuicao() {
|
||||
String nome = inputNomeStaff != null ? inputNomeStaff.getText().toString().trim() : "";
|
||||
if (nome.isEmpty()) {
|
||||
Toast.makeText(this, "Indique o nome do funcionário.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (spinnerMesaStaff == null || spinnerMesaStaff.getSelectedItem() == null) {
|
||||
Toast.makeText(this, "Selecione uma mesa.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
int mesaNumero = spinnerMesaStaff.getSelectedItemPosition() + 1;
|
||||
|
||||
StaffAssignment existente = findByNome(nome);
|
||||
if (existente == null) {
|
||||
staffAssignments.add(new StaffAssignment(nome, mesaNumero));
|
||||
txtMensagemStaff.setText(String.format("%s atribuído à mesa %02d.", nome, mesaNumero));
|
||||
} else {
|
||||
existente.mesaNumero = mesaNumero;
|
||||
txtMensagemStaff.setText(String.format("Mesa de %s atualizada para %02d.", nome, mesaNumero));
|
||||
}
|
||||
|
||||
refreshList();
|
||||
}
|
||||
|
||||
private StaffAssignment findByNome(String nome) {
|
||||
for (StaffAssignment item : staffAssignments) {
|
||||
if (item.nome.equalsIgnoreCase(nome)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void refreshList() {
|
||||
if (staffAdapter == null) return;
|
||||
|
||||
staffAdapter.clear();
|
||||
for (StaffAssignment item : staffAssignments) {
|
||||
String resumo = String.format("%s • Mesa %02d", item.nome, item.mesaNumero);
|
||||
staffAdapter.add(resumo);
|
||||
}
|
||||
staffAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private static class StaffAssignment {
|
||||
String nome;
|
||||
int mesaNumero;
|
||||
|
||||
StaffAssignment(String nome, int mesaNumero) {
|
||||
this.nome = nome;
|
||||
this.mesaNumero = mesaNumero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,26 @@ 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.firestore.FirebaseFirestore;
|
||||
import com.google.firebase.firestore.SetOptions;
|
||||
|
||||
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 +48,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 FirebaseFirestore firestore;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -47,10 +67,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
FirebaseApp.initializeApp(this);
|
||||
firebaseAuth = FirebaseAuth.getInstance();
|
||||
firestore = FirebaseFirestore.getInstance();
|
||||
|
||||
bindViews();
|
||||
setupTypeToggle();
|
||||
setupActionToggle();
|
||||
setupPrimaryAction();
|
||||
enforceFirstAccountCreation();
|
||||
}
|
||||
|
||||
private void bindViews() {
|
||||
@@ -62,6 +87,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 +125,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 +135,93 @@ 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 (selectedAccountAction == AccountAction.ENTRAR && !hasCreatedAccount) {
|
||||
Toast.makeText(this, "Crie uma conta para começar a usar a app.", Toast.LENGTH_SHORT).show();
|
||||
selectedAccountAction = AccountAction.CRIAR;
|
||||
updateActionButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
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)) {
|
||||
boolean creatingAccount = selectedAccountAction == AccountAction.CRIAR;
|
||||
|
||||
if (creatingAccount) {
|
||||
if (selectedAccountType == AccountType.CLIENTE && TextUtils.isEmpty(providedName)) {
|
||||
Toast.makeText(this, "Indique o seu nome para criar conta.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String fallbackName = !TextUtils.isEmpty(providedName) ? providedName : deriveNameFromEmail(email);
|
||||
Intent nextScreen;
|
||||
if (selectedAccountType == AccountType.ESTABELECIMENTO) {
|
||||
boolean missingOwner = TextUtils.isEmpty(providedName) || TextUtils.isEmpty(ownerPhone);
|
||||
boolean missingEstablishment = TextUtils.isEmpty(establishmentName)
|
||||
|| TextUtils.isEmpty(establishmentEmail)
|
||||
|| TextUtils.isEmpty(establishmentPhone);
|
||||
|
||||
if (selectedAccountType == AccountType.CLIENTE) {
|
||||
nextScreen = new Intent(this, ClientDashboardActivity.class);
|
||||
} else {
|
||||
nextScreen = new Intent(this, EstablishmentDashboardActivity.class);
|
||||
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 +236,206 @@ public class MainActivity extends AppCompatActivity {
|
||||
String rest = candidate.length() > 1 ? candidate.substring(1) : "";
|
||||
return firstLetter + rest;
|
||||
}
|
||||
|
||||
private void enforceFirstAccountCreation() {
|
||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
hasCreatedAccount = prefs.getBoolean(KEY_HAS_CREATED_ACCOUNT, false);
|
||||
|
||||
if (!hasCreatedAccount) {
|
||||
selectedAccountAction = AccountAction.CRIAR;
|
||||
Toast.makeText(this, "Crie uma conta para começar a usar a app.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
updateActionButtons();
|
||||
}
|
||||
|
||||
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 && firestore != 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 ->
|
||||
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,
|
||||
() -> {
|
||||
Intent createdScreen = new Intent(this, AccountCreatedActivity.class);
|
||||
createdScreen.putExtra(EXTRA_ACTION_MODE, selectedAccountAction.name());
|
||||
createdScreen.putExtra(EXTRA_DISPLAY_NAME, finalDisplayName);
|
||||
createdScreen.putExtra(EXTRA_EMAIL, email);
|
||||
createdScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
||||
createdScreen.putExtra(EXTRA_ROLE, resolvedRole);
|
||||
startActivity(createdScreen);
|
||||
}
|
||||
);
|
||||
})
|
||||
.addOnFailureListener(e ->
|
||||
Toast.makeText(this, "Falha ao criar conta: " + e.getMessage(), Toast.LENGTH_SHORT).show()
|
||||
);
|
||||
}
|
||||
|
||||
private void fetchAccountAndNavigate(String email, String fallbackName, String resolvedRole) {
|
||||
if (firestore == null) {
|
||||
Toast.makeText(this, "Firebase indisponível.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String documentId = buildDocumentId(email);
|
||||
firestore.collection("users")
|
||||
.document(documentId)
|
||||
.get()
|
||||
.addOnSuccessListener(snapshot -> {
|
||||
if (snapshot == null || !snapshot.exists()) {
|
||||
Toast.makeText(this, "Conta não encontrada no Firebase.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
String accountTypeInFirebase = snapshot.getString("accountType");
|
||||
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.getString("displayName");
|
||||
String establishmentName = snapshot.getString("establishmentName");
|
||||
String ownerName = snapshot.getString("ownerName");
|
||||
String roleFromDb = snapshot.getString("role");
|
||||
|
||||
String finalDisplayName = !TextUtils.isEmpty(establishmentName)
|
||||
? establishmentName
|
||||
: !TextUtils.isEmpty(displayNameFromDb) ? displayNameFromDb
|
||||
: !TextUtils.isEmpty(ownerName) ? ownerName
|
||||
: fallbackName;
|
||||
|
||||
String finalRole = !TextUtils.isEmpty(roleFromDb) ? roleFromDb : resolvedRole;
|
||||
|
||||
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, finalDisplayName);
|
||||
nextScreen.putExtra(EXTRA_EMAIL, email);
|
||||
nextScreen.putExtra(EXTRA_ACCOUNT_TYPE, selectedAccountType.name());
|
||||
nextScreen.putExtra(EXTRA_ROLE, finalRole);
|
||||
startActivity(nextScreen);
|
||||
})
|
||||
.addOnFailureListener(e ->
|
||||
Toast.makeText(this, "Erro ao verificar conta no Firebase.", Toast.LENGTH_SHORT).show()
|
||||
);
|
||||
}
|
||||
|
||||
private void persistAccountInFirebase(
|
||||
String ownerEmail,
|
||||
String ownerName,
|
||||
String role,
|
||||
String ownerPhone,
|
||||
String establishmentName,
|
||||
String establishmentEmail,
|
||||
String establishmentPhone,
|
||||
String uid,
|
||||
Runnable onSuccess
|
||||
) {
|
||||
if (firestore == 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);
|
||||
}
|
||||
|
||||
firestore.collection("users")
|
||||
.document(documentId)
|
||||
.set(payload, SetOptions.merge())
|
||||
.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()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,96 @@
|
||||
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" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputNomeStaff"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="Nome do funcionário"
|
||||
android:inputType="textPersonName"
|
||||
android:padding="12dp" />
|
||||
|
||||
<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" />
|
||||
|
||||
</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,6 +8,14 @@
|
||||
android:background="#F7F7F7"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoNaMesa"
|
||||
android:layout_width="90dp"
|
||||
@@ -40,26 +48,26 @@
|
||||
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_constraintTop_toBottomOf="@id/txtTitle"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="4dp" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/txtTitle" />
|
||||
|
||||
<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_marginTop="40dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardElevation="3dp">
|
||||
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"
|
||||
@@ -70,8 +78,8 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
@@ -79,10 +87,11 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_light"
|
||||
android:text="Cliente"
|
||||
android:textSize="5pt"
|
||||
android:background="@drawable/tab_selected"
|
||||
android:textAllCaps="false" />
|
||||
android:textAllCaps="false"
|
||||
android:textColorLink="#231F1F"
|
||||
android:textSize="5pt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnEstabelecimento"
|
||||
@@ -90,17 +99,18 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:backgroundTint="@color/black"
|
||||
android:text="Estabelecimento"
|
||||
android:textSize="5pt"
|
||||
android:textAllCaps="false" />
|
||||
android:textAllCaps="false"
|
||||
android:textSize="5pt" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_tabs"
|
||||
android:orientation="horizontal"
|
||||
android:padding="3dp">
|
||||
|
||||
<Button
|
||||
@@ -108,20 +118,20 @@
|
||||
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" />
|
||||
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:text="Criar Conta"
|
||||
android:textSize="5pt"
|
||||
android:background="@drawable/tab_unselected"
|
||||
android:textAllCaps="false" />
|
||||
android:text="Criar Conta"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="5pt" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
@@ -129,11 +139,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:inputType="textPersonName"
|
||||
android:hint="O seu nome"
|
||||
android:background="@drawable/input_bg"
|
||||
android:hint="O seu nome"
|
||||
android:inputType="textPersonName"
|
||||
android:padding="12dp"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
@@ -145,27 +155,75 @@
|
||||
android:inputType="textEmailAddress"
|
||||
android:padding="12dp" />
|
||||
|
||||
<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:inputType="textPassword"
|
||||
android:hint="Palavra-passe"
|
||||
android:background="@drawable/input_bg"
|
||||
android:padding="12dp"/>
|
||||
android:hint="Palavra-passe"
|
||||
android:inputType="textPassword"
|
||||
android:padding="12dp" />
|
||||
|
||||
<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:padding="12dp"
|
||||
android:text="Entrar"
|
||||
android:textAllCaps="false"
|
||||
android:padding="12dp"/>
|
||||
android:textColor="#FFF" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</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
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.13.1"
|
||||
agp = "8.13.2"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.3.0"
|
||||
espressoCore = "3.7.0"
|
||||
@@ -8,6 +8,8 @@ appcompat = "1.7.1"
|
||||
material = "1.13.0"
|
||||
activity = "1.11.0"
|
||||
constraintlayout = "2.2.1"
|
||||
firebaseBom = "33.7.0"
|
||||
googleServices = "4.4.2"
|
||||
|
||||
[libraries]
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
@@ -18,7 +20,9 @@ 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" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,4 +1,4 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user