- Fix storage permissions to use 'www' user instead of 'www-data' - Fix UserModel getAllForAdmin query to avoid placeholders in LIMIT/OFFSET - Import missing modules: Advertising, Dashboard, Analytics - Update deploy script to copy files to public directory
111 lines
6.2 KiB
PHP
111 lines
6.2 KiB
PHP
<?php
|
|
use App\Core\AssetPath;
|
|
use App\Core\OutputSanitize;
|
|
use App\Core\View;
|
|
?>
|
|
|
|
<div class="row" x-data="creativeEditModel()">
|
|
<div class="col-12">
|
|
<!-- Loading State -->
|
|
<div x-show="loading" class="text-center py-5">
|
|
<div class="spinner-border text-primary" role="status">
|
|
<span class="visually-hidden">A carregar...</span>
|
|
</div>
|
|
<p class="mt-3">A carregar dados do criativo...</p>
|
|
</div>
|
|
|
|
<!-- Error State -->
|
|
<div x-show="error && !loading" class="alert alert-danger">
|
|
<i class="ri-error-warning-line me-2"></i>
|
|
<span x-text="error"></span>
|
|
<a href="/advertising/creatives" class="btn btn-outline-danger btn-sm ms-3">
|
|
<i class="ri-arrow-left-line"></i> Voltar aos Criativos
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Success State -->
|
|
<div x-show="success" class="alert alert-success alert-dismissible fade show">
|
|
<i class="ri-check-line me-2"></i>
|
|
<span x-text="success"></span>
|
|
<button type="button" class="btn-close" @click="success = null"></button>
|
|
</div>
|
|
|
|
<!-- Creative Edit Form -->
|
|
<div x-show="creative && !loading" class="card shadow-sm border-0">
|
|
<div class="card-header bg-light d-flex align-items-center gap-2">
|
|
<i class="ri-image-edit-line fs-3 text-primary"></i>
|
|
<h4 class="card-title mb-0 flex-grow-1">Editar Criativo</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<form @submit.prevent="submitForm()" autocomplete="off">
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label for="name" class="form-label">Nome do Criativo <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="name" x-model="formData.name" required maxlength="255">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="format_id" class="form-label">Formato <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="format_id" x-model="formData.format_id" required>
|
|
<option value="">Selecione...</option>
|
|
<template x-for="option in formatOptions" :key="option.value">
|
|
<option :value="option.value" x-text="option.label"></option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="file_name" class="form-label">Nome do Ficheiro</label>
|
|
<input type="text" class="form-control" id="file_name" x-model="formData.file_name" maxlength="255">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="file_path" class="form-label">Caminho do Ficheiro</label>
|
|
<input type="text" class="form-control" id="file_path" x-model="formData.file_path" maxlength="500">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="width" class="form-label">Largura (px)</label>
|
|
<input type="number" class="form-control" id="width" x-model="formData.width" min="1" max="2000">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="height" class="form-label">Altura (px)</label>
|
|
<input type="number" class="form-control" id="height" x-model="formData.height" min="1" max="2000">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="click_url" class="form-label">URL de Clique</label>
|
|
<input type="url" class="form-control" id="click_url" x-model="formData.click_url" maxlength="500">
|
|
</div>
|
|
<div class="col-12">
|
|
<label for="alt_text" class="form-label">Texto Alternativo</label>
|
|
<input type="text" class="form-control" id="alt_text" x-model="formData.alt_text" maxlength="255">
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="mime_type" class="form-label">Tipo MIME</label>
|
|
<select class="form-select" id="mime_type" x-model="formData.mime_type">
|
|
<option value="">Selecione...</option>
|
|
<template x-for="option in mimeTypeOptions" :key="option.value">
|
|
<option :value="option.value" x-text="option.label"></option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label for="is_active" class="form-label">Status</label>
|
|
<select class="form-select" id="is_active" x-model="formData.is_active">
|
|
<template x-for="option in getStatusOptions()" :key="option.value">
|
|
<option :value="option.value" x-text="option.label"></option>
|
|
</template>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<hr class="my-4">
|
|
<div class="d-flex justify-content-between align-items-center gap-2">
|
|
<a href="/advertising/creatives" class="btn btn-light">
|
|
<i class="ri-arrow-go-back-line me-1"></i> Voltar
|
|
</a>
|
|
<button type="submit" class="btn btn-primary" :disabled="loading">
|
|
<i class="ri-save-line me-1"></i>
|
|
<span x-text="loading ? 'A guardar...' : 'Guardar Alterações'"></span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|