45
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$this->call(SignatureSeeder::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\EditableField;
|
||||
use App\Models\Template;
|
||||
use App\Models\Tenant;
|
||||
use App\Signature\VariableMap;
|
||||
use Illuminate\Database\Seeder;
|
||||
use RuntimeException;
|
||||
|
||||
/** Données initiales : tenant CABM, champs modifiables (tous fermés), template par défaut. */
|
||||
class SignatureSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tid = config('signature.default_tenant.entra_tenant_id');
|
||||
if (! $tid) {
|
||||
throw new RuntimeException('ENTRA_TENANT_ID absent du .env');
|
||||
}
|
||||
|
||||
$tenant = Tenant::firstOrCreate(
|
||||
['entra_tenant_id' => $tid],
|
||||
['name' => config('signature.default_tenant.name'), 'active' => true],
|
||||
);
|
||||
|
||||
// L'admin choisira dans le back-office les champs ouverts aux agents.
|
||||
foreach (['mobile', 'telephone', 'bureau', 'fonction'] as $field) {
|
||||
EditableField::firstOrCreate(
|
||||
['tenant_id' => $tenant->id, 'field' => $field],
|
||||
['label' => VariableMap::FIELDS[$field]['label'], 'enabled' => false],
|
||||
);
|
||||
}
|
||||
|
||||
if (! Template::where('tenant_id', $tenant->id)->exists()) {
|
||||
$template = Template::create([
|
||||
'tenant_id' => $tenant->id,
|
||||
'name' => 'Agents — défaut',
|
||||
'description' => 'Template par défaut, appliqué aux agents hors groupe signature_mail_*.',
|
||||
'draft_html_full' => file_get_contents(database_path('seeders/templates/agents-full.html')),
|
||||
'draft_html_short' => file_get_contents(database_path('seeders/templates/agents-short.html')),
|
||||
'is_default' => true,
|
||||
]);
|
||||
$template->publish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:18px;color:#1b1b1b;border-collapse:collapse">
|
||||
<tr>
|
||||
<td style="padding:0 16px 0 0;vertical-align:top;border-right:2px solid #0b5cad">
|
||||
<img src="{{site_url}}/img/logo-cabm.png" alt="Agglo Béziers Méditerranée" width="120" style="display:block;border:0">
|
||||
</td>
|
||||
<td style="padding:0 0 0 16px;vertical-align:top">
|
||||
<strong style="font-size:14px">{{prenom}} {{nom}}</strong><br>
|
||||
{{#if fonction}}{{fonction}}<br>{{/if}}
|
||||
{{#if service}}<span style="color:#5c5c5c">{{service}}</span><br>{{/if}}
|
||||
{{#if telephone}}Tél. {{telephone}}<br>{{/if}}
|
||||
{{#if mobile}}Mob. {{mobile}}<br>{{/if}}
|
||||
{{#if adresse}}<span style="color:#5c5c5c">{{adresse}}{{#if code_postal}}, {{code_postal}} {{ville}}{{/if}}</span><br>{{/if}}
|
||||
<a href="https://www.beziers-mediterranee.fr" style="color:#0b5cad;text-decoration:none">beziers-mediterranee.fr</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{#if banniere}}<tr><td colspan="2" style="padding:12px 0 0 0">{{{banniere}}}</td></tr>{{/if}}
|
||||
</table>
|
||||
@@ -0,0 +1,4 @@
|
||||
<p style="font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:18px;color:#1b1b1b;margin:0">
|
||||
<strong>{{prenom}} {{nom}}</strong>{{#if fonction}} · {{fonction}}{{/if}}<br>
|
||||
Agglo Béziers Méditerranée{{#if telephone}} · {{telephone}}{{/if}}
|
||||
</p>
|
||||
Reference in New Issue
Block a user