Compare commits
No commits in common. "951b44f7ebcd524082167140473cfe52299a395d" and "ef4d189ef113c59fa5ae587f886a460e9f8c9e9c" have entirely different histories.
951b44f7eb
...
ef4d189ef1
254
.github/workflows/deploy-bcards.yml
vendored
254
.github/workflows/deploy-bcards.yml
vendored
@ -1,254 +0,0 @@
|
|||||||
name: Deploy BCards
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main, 'release/*' ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: registry.redecarneir.us
|
|
||||||
IMAGE_NAME: bcards
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v4
|
|
||||||
with:
|
|
||||||
dotnet-version: 8.0.x
|
|
||||||
|
|
||||||
- name: Cache dependencies
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.nuget/packages
|
|
||||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-nuget-
|
|
||||||
|
|
||||||
- name: Restore dependencies
|
|
||||||
run: dotnet restore
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build --no-restore --configuration Release
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage"
|
|
||||||
|
|
||||||
- name: Upload coverage
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
files: coverage.cobertura.xml
|
|
||||||
|
|
||||||
build-and-push:
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Determine build settings
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
||||||
echo "TAG=latest" >> $GITHUB_ENV
|
|
||||||
echo "PLATFORM=linux/arm64" >> $GITHUB_ENV
|
|
||||||
echo "ENVIRONMENT=Production" >> $GITHUB_ENV
|
|
||||||
elif [[ "${{ github.ref }}" == refs/heads/release/* ]]; then
|
|
||||||
# Extrai versão da branch (release/v1.0.0 -> v1.0.0)
|
|
||||||
VERSION=$(echo "${{ github.ref }}" | sed 's/refs\/heads\/release\///')
|
|
||||||
echo "TAG=${VERSION}" >> $GITHUB_ENV
|
|
||||||
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV
|
|
||||||
echo "ENVIRONMENT=Staging" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and push to registry
|
|
||||||
run: |
|
|
||||||
# Build da imagem para a plataforma correta
|
|
||||||
docker buildx build \
|
|
||||||
--platform ${{ env.PLATFORM }} \
|
|
||||||
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} \
|
|
||||||
--push \
|
|
||||||
.
|
|
||||||
|
|
||||||
deploy-production:
|
|
||||||
needs: build-and-push
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
environment: production
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Deploy to Production Servers (ARM - OCI)
|
|
||||||
run: |
|
|
||||||
# Configura SSH
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
# Deploy no Servidor 1 (ARM - OCI)
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@141.148.162.114 << 'EOF'
|
|
||||||
# Remove containers bcards-infrastructure se existirem
|
|
||||||
docker stop bcards-infrastructure || true
|
|
||||||
docker rm bcards-infrastructure || true
|
|
||||||
docker stop bcards-test-app || true
|
|
||||||
docker rm bcards-test-app || true
|
|
||||||
|
|
||||||
# Para o container BCards atual se existir
|
|
||||||
docker stop bcards-prod || true
|
|
||||||
docker rm bcards-prod || true
|
|
||||||
|
|
||||||
# Remove imagem antiga
|
|
||||||
docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest || true
|
|
||||||
|
|
||||||
# Puxa nova imagem
|
|
||||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|
||||||
# Executa novo container BCards
|
|
||||||
docker run -d \
|
|
||||||
--name bcards-prod \
|
|
||||||
--restart unless-stopped \
|
|
||||||
-p 5002:8080 \
|
|
||||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
|
||||||
-e ASPNETCORE_URLS=http://+:8080 \
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|
||||||
# Recarrega NGINX
|
|
||||||
sudo nginx -t && sudo systemctl reload nginx
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Deploy no Servidor 2 (ARM - OCI)
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@129.146.116.218 << 'EOF'
|
|
||||||
# Remove containers bcards-infrastructure se existirem
|
|
||||||
docker stop bcards-infrastructure || true
|
|
||||||
docker rm bcards-infrastructure || true
|
|
||||||
docker stop bcards-test-app || true
|
|
||||||
docker rm bcards-test-app || true
|
|
||||||
|
|
||||||
# Para o container BCards atual se existir
|
|
||||||
docker stop bcards-prod || true
|
|
||||||
docker rm bcards-prod || true
|
|
||||||
|
|
||||||
# Remove imagem antiga
|
|
||||||
docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest || true
|
|
||||||
|
|
||||||
# Puxa nova imagem
|
|
||||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
|
|
||||||
# Executa novo container BCards
|
|
||||||
docker run -d \
|
|
||||||
--name bcards-prod \
|
|
||||||
--restart unless-stopped \
|
|
||||||
-p 5002:8080 \
|
|
||||||
-e ASPNETCORE_ENVIRONMENT=Production \
|
|
||||||
-e ASPNETCORE_URLS=http://+:8080 \
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Health Check Production
|
|
||||||
run: |
|
|
||||||
# Aguarda containers subirem
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Verifica se os serviços estão respondendo
|
|
||||||
echo "Verificando Servidor 1 (ARM)..."
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@141.148.162.114 'curl -f http://localhost:5002/health || echo "Servidor 1 pode não estar respondendo"'
|
|
||||||
|
|
||||||
echo "Verificando Servidor 2 (ARM)..."
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@129.146.116.218 'curl -f http://localhost:5002/health || echo "Servidor 2 pode não estar respondendo"'
|
|
||||||
|
|
||||||
deploy-staging:
|
|
||||||
needs: build-and-push
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: startsWith(github.ref, 'refs/heads/release/')
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Deploy to Staging Server (x86 - Local)
|
|
||||||
run: |
|
|
||||||
# Configura SSH
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
# Extrai versão da branch
|
|
||||||
VERSION=$(echo "${{ github.ref }}" | sed 's/refs\/heads\/release\///')
|
|
||||||
|
|
||||||
# Deploy no Servidor Local x86
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@192.168.0.100 << EOF
|
|
||||||
# Remove containers bcards-infrastructure se existirem
|
|
||||||
docker stop bcards-infrastructure || true
|
|
||||||
docker rm bcards-infrastructure || true
|
|
||||||
docker stop bcards-test-app || true
|
|
||||||
docker rm bcards-test-app || true
|
|
||||||
|
|
||||||
# Para o container BCards atual se existir
|
|
||||||
docker stop bcards-staging || true
|
|
||||||
docker rm bcards-staging || true
|
|
||||||
|
|
||||||
# Remove imagem antiga
|
|
||||||
docker rmi ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} || true
|
|
||||||
|
|
||||||
# Puxa nova imagem
|
|
||||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
|
|
||||||
|
|
||||||
# Executa novo container BCards
|
|
||||||
docker run -d \
|
|
||||||
--name bcards-staging \
|
|
||||||
--restart unless-stopped \
|
|
||||||
-p 5002:8080 \
|
|
||||||
-e ASPNETCORE_ENVIRONMENT=Staging \
|
|
||||||
-e ASPNETCORE_URLS=http://+:8080 \
|
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Health Check Staging
|
|
||||||
run: |
|
|
||||||
# Aguarda container subir
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Verifica se o serviço está respondendo
|
|
||||||
echo "Verificando Servidor Staging (x86)..."
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@192.168.0.100 'curl -f http://localhost:5002/health || echo "Servidor staging pode não estar respondendo"'
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
needs: [deploy-production, deploy-staging]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: always() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/'))
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Cleanup old containers and images
|
|
||||||
run: |
|
|
||||||
# Configura SSH
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
# Lista de servidores baseada na branch
|
|
||||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
||||||
SERVERS=("141.148.162.114" "129.146.116.218")
|
|
||||||
else
|
|
||||||
SERVERS=("192.168.0.100")
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Limpeza em cada servidor
|
|
||||||
for server in "${SERVERS[@]}"; do
|
|
||||||
echo "Limpando servidor $server..."
|
|
||||||
ssh -o StrictHostKeyChecking=no ubuntu@$server << 'EOF'
|
|
||||||
# Remove containers parados
|
|
||||||
docker container prune -f
|
|
||||||
|
|
||||||
# Remove imagens não utilizadas (mantém as mais recentes)
|
|
||||||
docker image prune -f
|
|
||||||
|
|
||||||
# Remove redes não utilizadas
|
|
||||||
docker network prune -f
|
|
||||||
EOF
|
|
||||||
done
|
|
||||||
@ -114,14 +114,13 @@ public class PaymentController : Controller
|
|||||||
// Parse do plano atual (mesmo que o Dashboard)
|
// Parse do plano atual (mesmo que o Dashboard)
|
||||||
var userPlanType = Enum.TryParse<PlanType>(user.CurrentPlan, true, out var planType) ? planType : PlanType.Trial;
|
var userPlanType = Enum.TryParse<PlanType>(user.CurrentPlan, true, out var planType) ? planType : PlanType.Trial;
|
||||||
var currentPlanString = userPlanType.ToString().ToLower();
|
var currentPlanString = userPlanType.ToString().ToLower();
|
||||||
var subscription = await _subscriptionRepository.GetByUserIdAsync(user.Id);
|
|
||||||
var viewModel = new ManageSubscriptionViewModel
|
var viewModel = new ManageSubscriptionViewModel
|
||||||
{
|
{
|
||||||
User = user,
|
User = user,
|
||||||
StripeSubscription = await _paymentService.GetSubscriptionDetailsAsync(user.Id),
|
StripeSubscription = await _paymentService.GetSubscriptionDetailsAsync(user.Id),
|
||||||
PaymentHistory = await _paymentService.GetPaymentHistoryAsync(user.Id),
|
PaymentHistory = await _paymentService.GetPaymentHistoryAsync(user.Id),
|
||||||
AvailablePlans = GetAvailablePlans(currentPlanString),
|
AvailablePlans = GetAvailablePlans(currentPlanString)
|
||||||
CurrentPeriodEnd = (DateTime?) subscription.CurrentPeriodEnd
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pegar assinatura local se existir
|
// Pegar assinatura local se existir
|
||||||
|
|||||||
@ -87,7 +87,7 @@ builder.Services.AddAuthentication(options =>
|
|||||||
{
|
{
|
||||||
OnRedirectToAuthorizationEndpoint = context =>
|
OnRedirectToAuthorizationEndpoint = context =>
|
||||||
{
|
{
|
||||||
context.Response.Redirect(context.RedirectUri + "&prompt=login");
|
context.Response.Redirect(context.RedirectUri + "&prompt=select_account");
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public class ManageSubscriptionViewModel
|
|||||||
public bool CanDowngrade => HasActiveSubscription && User.CurrentPlan != "basic";
|
public bool CanDowngrade => HasActiveSubscription && User.CurrentPlan != "basic";
|
||||||
public bool WillCancelAtPeriodEnd => StripeSubscription?.CancelAtPeriodEnd == true;
|
public bool WillCancelAtPeriodEnd => StripeSubscription?.CancelAtPeriodEnd == true;
|
||||||
|
|
||||||
public DateTime? CurrentPeriodEnd { get; set; }
|
public DateTime? CurrentPeriodEnd => null;
|
||||||
public DateTime? NextBillingDate => !WillCancelAtPeriodEnd ? CurrentPeriodEnd : null;
|
public DateTime? NextBillingDate => !WillCancelAtPeriodEnd ? CurrentPeriodEnd : null;
|
||||||
|
|
||||||
public decimal? MonthlyAmount => StripeSubscription?.Items?.Data?.FirstOrDefault()?.Price?.UnitAmount / 100m;
|
public decimal? MonthlyAmount => StripeSubscription?.Items?.Data?.FirstOrDefault()?.Price?.UnitAmount / 100m;
|
||||||
|
|||||||
@ -93,15 +93,13 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
<div class="d-flex gap-1 align-items-center" data-page-id="@pageItem.Id" data-status="@pageItem.Status">
|
||||||
<!-- Cards com Hover Effect -->
|
<!-- Botão Ver - sempre presente quando possível -->
|
||||||
<div class="card-footer" data-page-id="@pageItem.Id" data-status="@pageItem.Status">
|
|
||||||
<div class="d-flex gap-2">
|
|
||||||
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Active)
|
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Active)
|
||||||
{
|
{
|
||||||
<a href="/page/@pageItem.Category/@pageItem.Slug" target="_blank"
|
<a href="/page/@pageItem.Category/@pageItem.Slug" target="_blank"
|
||||||
class="btn btn-success flex-fill">
|
class="btn btn-sm btn-success">
|
||||||
<i class="fas fa-eye me-1"></i>Ver Página
|
<i class="fas fa-external-link-alt me-1"></i>Ver
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
else if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Creating ||
|
else if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Creating ||
|
||||||
@ -109,30 +107,24 @@
|
|||||||
pageItem.Status == BCards.Web.ViewModels.PageStatus.PendingModeration)
|
pageItem.Status == BCards.Web.ViewModels.PageStatus.PendingModeration)
|
||||||
{
|
{
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-outline-info flex-fill"
|
class="btn btn-sm btn-outline-info"
|
||||||
onclick="openPreview('@pageItem.Id')"
|
onclick="openPreview('@pageItem.Id')"
|
||||||
data-page-category="@pageItem.Category"
|
data-page-category="@pageItem.Category"
|
||||||
data-page-slug="@pageItem.Slug">
|
data-page-slug="@pageItem.Slug">
|
||||||
<i class="fas fa-vial me-1"></i>Testar Página
|
<i class="fas fa-eye me-1"></i>Testar
|
||||||
</button>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<button class="btn btn-secondary flex-fill" disabled>
|
|
||||||
<i class="fas fa-ban me-1"></i>Indisponível
|
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="btn-group">
|
<!-- Dropdown para outras ações -->
|
||||||
<button class="btn btn-outline-secondary dropdown-toggle"
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-sm btn-outline-secondary dropdown-toggle"
|
||||||
type="button"
|
type="button"
|
||||||
id="dropdownMenuButton@(pageItem.Id)"
|
id="dropdownMenuButton@(pageItem.Id)"
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
aria-expanded="false"
|
aria-expanded="false">
|
||||||
title="Mais opções">
|
Ações
|
||||||
<i class="fas fa-cog"></i>
|
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuButton@(pageItem.Id)">
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton@(pageItem.Id)">
|
||||||
<!-- Editar - sempre presente -->
|
<!-- Editar - sempre presente -->
|
||||||
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.PendingModeration)
|
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.PendingModeration)
|
||||||
{
|
{
|
||||||
@ -152,6 +144,7 @@
|
|||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Creating ||
|
@if (pageItem.Status == BCards.Web.ViewModels.PageStatus.Creating ||
|
||||||
pageItem.Status == BCards.Web.ViewModels.PageStatus.Rejected)
|
pageItem.Status == BCards.Web.ViewModels.PageStatus.Rejected)
|
||||||
{
|
{
|
||||||
@ -177,14 +170,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Informações da página movidas para baixo dos botões -->
|
<div class="card-footer bg-transparent">
|
||||||
<div class="px-3 pt-2 pb-1">
|
|
||||||
<small class="text-muted">Criada em @(pageItem.CreatedAt.ToString("dd/MM/yyyy"))</small>
|
<small class="text-muted">Criada em @(pageItem.CreatedAt.ToString("dd/MM/yyyy"))</small>
|
||||||
|
|
||||||
@if ((pageItem.LastModerationStatus ?? pageItem.Status) == BCards.Web.ViewModels.PageStatus.Rejected && !string.IsNullOrEmpty(pageItem.Motive))
|
@if ((pageItem.LastModerationStatus ?? pageItem.Status) == BCards.Web.ViewModels.PageStatus.Rejected && !string.IsNullOrEmpty(pageItem.Motive))
|
||||||
{
|
{
|
||||||
<div class="alert alert-danger alert-dismissible fade show mt-2 mb-0" role="alert">
|
<div class="alert alert-danger alert-dismissible fade show mt-2" role="alert">
|
||||||
<div class="d-flex align-items-start">
|
<div class="d-flex align-items-start">
|
||||||
<i class="fas fa-exclamation-triangle me-2 mt-1"></i>
|
<i class="fas fa-exclamation-triangle me-2 mt-1"></i>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
@ -197,7 +188,7 @@
|
|||||||
}
|
}
|
||||||
else if (pageItem.LastModerationStatus == BCards.Web.ViewModels.PageStatus.Active && !string.IsNullOrEmpty(pageItem.Motive))
|
else if (pageItem.LastModerationStatus == BCards.Web.ViewModels.PageStatus.Active && !string.IsNullOrEmpty(pageItem.Motive))
|
||||||
{
|
{
|
||||||
<div class="alert alert-info alert-dismissible fade show mt-2 mb-0" role="alert">
|
<div class="alert alert-info alert-dismissible fade show mt-2" role="alert">
|
||||||
<div class="d-flex align-items-start">
|
<div class="d-flex align-items-start">
|
||||||
<i class="fas fa-exclamation-triangle me-2 mt-1"></i>
|
<i class="fas fa-exclamation-triangle me-2 mt-1"></i>
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
@ -207,11 +198,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
@if ((pageItem.LastModerationStatus ?? pageItem.Status) == BCards.Web.ViewModels.PageStatus.Creating)
|
@if ((pageItem.LastModerationStatus ?? pageItem.Status) == BCards.Web.ViewModels.PageStatus.Creating)
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<div class="d-flex gap-2 flex-wrap">
|
<div class="btn-group" role="group">
|
||||||
@if (!Model.WillCancelAtPeriodEnd)
|
@if (!Model.WillCancelAtPeriodEnd)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#cancelModal">
|
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#cancelModal">
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<form method="post" action="@Url.Action("OpenStripePortal")" class="d-inline">
|
<form method="post" action="@Url.Action("OpenStripePortal")" style="display: inline;">
|
||||||
<button type="submit" class="btn btn-outline-primary">
|
<button type="submit" class="btn btn-outline-primary">
|
||||||
<i class="fas fa-external-link-alt me-1"></i>
|
<i class="fas fa-external-link-alt me-1"></i>
|
||||||
Portal de Pagamento
|
Portal de Pagamento
|
||||||
|
|||||||
@ -39,76 +39,8 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="~/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="~/favicon.ico" />
|
||||||
|
|
||||||
@await RenderSectionAsync("Styles", required: false)
|
@await RenderSectionAsync("Styles", required: false)
|
||||||
|
|
||||||
<!-- Estilos para menu ativo e barra de carregamento -->
|
|
||||||
<style>
|
|
||||||
/* Barra de carregamento moderna */
|
|
||||||
#loading-bar {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 0%;
|
|
||||||
height: 3px;
|
|
||||||
background: linear-gradient(90deg, #007bff, #0056b3, #007bff);
|
|
||||||
background-size: 200% 100%;
|
|
||||||
animation: loading-shimmer 1.5s infinite;
|
|
||||||
z-index: 9999;
|
|
||||||
transition: width 0.3s ease, opacity 0.3s ease;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#loading-bar.active {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@keyframes loading-shimmer {
|
|
||||||
0% { background-position: -200% 0; }
|
|
||||||
100% { background-position: 200% 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Destacar item ativo do menu */
|
|
||||||
.nav-link.active {
|
|
||||||
background-color: rgba(0, 123, 255, 0.1) !important;
|
|
||||||
border-radius: 6px !important;
|
|
||||||
font-weight: 600 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Para homepage (fundo azul) */
|
|
||||||
.bg-home-blue .nav-link.active {
|
|
||||||
background-color: rgba(255, 255, 255, 0.2) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Smooth transition para links */
|
|
||||||
.nav-link {
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
padding: 8px 12px !important;
|
|
||||||
margin: 0 2px;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link:hover {
|
|
||||||
background-color: rgba(0, 123, 255, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-home-blue .nav-link:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Suavizar transições de página */
|
|
||||||
main {
|
|
||||||
opacity: 1;
|
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
main.page-loading {
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Barra de carregamento -->
|
|
||||||
<div id="loading-bar"></div>
|
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light fixed-top @(ViewBag.IsHomePage == true ? "bg-home-blue" : "bg-dashboard")" id="mainNavbar">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light fixed-top @(ViewBag.IsHomePage == true ? "bg-home-blue" : "bg-dashboard")" id="mainNavbar">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -223,107 +155,6 @@
|
|||||||
<script src="~/lib/jquery/jquery.min.js"></script>
|
<script src="~/lib/jquery/jquery.min.js"></script>
|
||||||
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
<!-- Scripts para menu ativo e barra de carregamento -->
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
// Destacar item ativo do menu baseado na URL atual
|
|
||||||
highlightActiveMenuItem();
|
|
||||||
|
|
||||||
// Interceptar cliques em links de navegação
|
|
||||||
setupLoadingBar();
|
|
||||||
});
|
|
||||||
|
|
||||||
function highlightActiveMenuItem() {
|
|
||||||
var currentPath = window.location.pathname.toLowerCase();
|
|
||||||
var currentController = '@ViewContext.RouteData.Values["Controller"]?.ToString()?.ToLower()';
|
|
||||||
var currentAction = '@ViewContext.RouteData.Values["Action"]?.ToString()?.ToLower()';
|
|
||||||
|
|
||||||
// Remover classes ativas existentes
|
|
||||||
$('.nav-link').removeClass('active');
|
|
||||||
|
|
||||||
// Lógica para destacar o item correto
|
|
||||||
$('.nav-link').each(function() {
|
|
||||||
var link = $(this);
|
|
||||||
var href = link.attr('href');
|
|
||||||
|
|
||||||
if (href) {
|
|
||||||
var linkPath = href.toLowerCase();
|
|
||||||
|
|
||||||
// Verificar correspondência exata primeiro
|
|
||||||
if (currentPath === linkPath ||
|
|
||||||
(currentPath === '/' && linkPath.includes('/home')) ||
|
|
||||||
(currentController === 'home' && currentAction === 'index' && linkPath.includes('/home')) ||
|
|
||||||
(currentController === 'home' && currentAction === 'pricing' && linkPath.includes('pricing')) ||
|
|
||||||
(currentController === 'admin' && linkPath.includes('dashboard')) ||
|
|
||||||
(currentController === 'moderation' && linkPath.includes('moderation')) ||
|
|
||||||
(currentController === 'auth' && linkPath.includes('login')) ||
|
|
||||||
(currentController === 'payment' && linkPath.includes('managesubscription'))) {
|
|
||||||
link.addClass('active');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupLoadingBar() {
|
|
||||||
var loadingBar = $('#loading-bar');
|
|
||||||
|
|
||||||
// Interceptar todos os cliques em links que navegam para outras páginas
|
|
||||||
$('a[href]:not([href^="#"]):not([href^="javascript:"]):not([target="_blank"]):not(.no-loading)').click(function(e) {
|
|
||||||
var href = $(this).attr('href');
|
|
||||||
|
|
||||||
// Ignorar links externos, downloads, ou âncoras
|
|
||||||
if (href && !href.startsWith('http') && !href.startsWith('mailto:') && !href.startsWith('tel:')) {
|
|
||||||
showLoadingBar();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Interceptar submissão de formulários
|
|
||||||
$('form:not(.no-loading)').submit(function() {
|
|
||||||
showLoadingBar();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Ocultar barra quando página carrega
|
|
||||||
$(window).on('load', function() {
|
|
||||||
hideLoadingBar();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Ocultar barra em caso de erro ou volta do histórico
|
|
||||||
$(window).on('pageshow', function() {
|
|
||||||
hideLoadingBar();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showLoadingBar() {
|
|
||||||
var loadingBar = $('#loading-bar');
|
|
||||||
loadingBar.addClass('active').css('width', '0%');
|
|
||||||
|
|
||||||
// Animação progressiva
|
|
||||||
setTimeout(function() { loadingBar.css('width', '20%'); }, 100);
|
|
||||||
setTimeout(function() { loadingBar.css('width', '40%'); }, 300);
|
|
||||||
setTimeout(function() { loadingBar.css('width', '60%'); }, 600);
|
|
||||||
setTimeout(function() { loadingBar.css('width', '80%'); }, 1000);
|
|
||||||
|
|
||||||
// Adicionar efeito de loading ao conteúdo
|
|
||||||
$('main').addClass('page-loading');
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideLoadingBar() {
|
|
||||||
var loadingBar = $('#loading-bar');
|
|
||||||
loadingBar.css('width', '100%');
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
loadingBar.removeClass('active').css('width', '0%');
|
|
||||||
$('main').removeClass('page-loading');
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback para esconder loading se demorar muito (mais de 5 segundos)
|
|
||||||
setTimeout(function() {
|
|
||||||
hideLoadingBar();
|
|
||||||
}, 5000);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -310,10 +310,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="toast-body">
|
<div class="toast-body">
|
||||||
<p class="mb-2"><strong>Você está visualizando uma prévia!</strong></p>
|
<p class="mb-2"><strong>Você está visualizando uma prévia!</strong></p>
|
||||||
<p class="mb-2 small">• Para fazer alterações, volte ao Dashboard e clique <i class="fas fa-cog"></i></p>
|
<p class="mb-2 small">• Para fazer alterações, volte ao Dashboard</p>
|
||||||
<p class="mb-2 small">• Esta prévia não é a página final publicada</p>
|
<p class="mb-2 small">• Esta prévia não é a página final publicada</p>
|
||||||
<button type="button" class="btn btn-sm btn-primary w-100" onclick="goBackToDashboard()">
|
<button type="button" class="btn btn-sm btn-primary w-100" onclick="goBackToDashboard()">
|
||||||
<i class="fas fa-cog"></i> >>
|
<i class="fas fa-edit me-1"></i>
|
||||||
Editar Página
|
Editar Página
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user