Changes 0128092025
This commit is contained in:
parent
a913cfc381
commit
765beb78b7
21
app/Http/Controllers/FieldJobSettingController.php
Normal file
21
app/Http/Controllers/FieldJobSettingController.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\FieldJobSetting;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class FieldJobSettingController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$settings = FieldJobSetting::query()
|
||||
->with(['segment', 'asignDecision', 'completeDecision'])
|
||||
->get();
|
||||
|
||||
return Inertia::render('Settings/FieldJob/Index', [
|
||||
'settings' => $settings,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,17 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Segment;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class SegmentController extends Controller
|
||||
{
|
||||
//
|
||||
public function settings(Request $request)
|
||||
{
|
||||
return Inertia::render('Settings/Segments/Index', [
|
||||
'segments' => Segment::query()->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,127 +10,8 @@ class SettingController extends Controller
|
|||
//
|
||||
|
||||
public function index(Request $request){
|
||||
|
||||
return Inertia::render('Settings/Index', [
|
||||
'actions' => \App\Models\Action::query()
|
||||
->with(['decisions', 'segment'])
|
||||
->get(),
|
||||
'decisions' => \App\Models\Decision::query()
|
||||
->with('actions')
|
||||
->get(),
|
||||
'segments' => \App\Models\Segment::query()
|
||||
->get()
|
||||
]
|
||||
);
|
||||
return Inertia::render('Settings/Index');
|
||||
}
|
||||
|
||||
public function storeAction(Request $request)
|
||||
{
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'segment_id' => 'nullable|integer|exists:segments,id',
|
||||
'decisions' => 'nullable|array',
|
||||
'decisions.*.id' => 'required_with:decisions.*|integer|exists:decisions,id',
|
||||
'decisions.*.name' => 'required_with:decisions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$decisionIds = collect($attributes['decisions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $decisionIds) {
|
||||
/** @var \App\Models\Action $row */
|
||||
$row = \App\Models\Action::create([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
'segment_id' => $attributes['segment_id'] ?? null,
|
||||
]);
|
||||
|
||||
if (!empty($decisionIds)) {
|
||||
$row->decisions()->sync($decisionIds);
|
||||
}
|
||||
});
|
||||
|
||||
return to_route('settings')->with('success', 'Action created successfully!');
|
||||
}
|
||||
|
||||
public function updateAction(int $id, Request $request) {
|
||||
|
||||
$row = \App\Models\Action::findOrFail($id);
|
||||
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'segment_id' => 'nullable|integer|exists:segments,id',
|
||||
'decisions' => 'nullable|array',
|
||||
'decisions.*.id' => 'required_with:decisions.*|integer|exists:decisions,id',
|
||||
'decisions.*.name' => 'required_with:decisions.*|string|max:50'
|
||||
]);
|
||||
|
||||
$decisionIds = collect($attributes['decisions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function() use ($attributes, $decisionIds, $row) {
|
||||
$row->update([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'],
|
||||
'segment_id' => $attributes['segment_id'] ?? null,
|
||||
]);
|
||||
|
||||
$row->decisions()->sync($decisionIds);
|
||||
});
|
||||
logger()->info('Model updated successfully', ['model_id' => $row->id]);
|
||||
return to_route('settings')->with('success', 'Update successful!');
|
||||
|
||||
}
|
||||
|
||||
public function storeDecision(Request $request)
|
||||
{
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'actions' => 'nullable|array',
|
||||
'actions.*.id' => 'required_with:actions.*|integer|exists:actions,id',
|
||||
'actions.*.name' => 'required_with:actions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$actionIds = collect($attributes['actions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $actionIds) {
|
||||
/** @var \App\Models\Decision $row */
|
||||
$row = \App\Models\Decision::create([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
]);
|
||||
|
||||
if (!empty($actionIds)) {
|
||||
$row->actions()->sync($actionIds);
|
||||
}
|
||||
});
|
||||
|
||||
return to_route('settings')->with('success', 'Decision created successfully!');
|
||||
}
|
||||
|
||||
public function updateDecision(int $id, Request $request)
|
||||
{
|
||||
$row = \App\Models\Decision::findOrFail($id);
|
||||
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'actions' => 'nullable|array',
|
||||
'actions.*.id' => 'required_with:actions.*|integer|exists:actions,id',
|
||||
'actions.*.name' => 'required_with:actions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$actionIds = collect($attributes['actions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $actionIds, $row) {
|
||||
$row->update([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
]);
|
||||
$row->actions()->sync($actionIds);
|
||||
});
|
||||
|
||||
return to_route('settings')->with('success', 'Decision updated successfully!');
|
||||
}
|
||||
// Workflow actions/decisions moved to WorkflowController
|
||||
}
|
||||
|
|
|
|||
130
app/Http/Controllers/WorkflowController.php
Normal file
130
app/Http/Controllers/WorkflowController.php
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Action;
|
||||
use App\Models\Decision;
|
||||
use App\Models\Segment;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class WorkflowController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return Inertia::render('Settings/Workflow/Index', [
|
||||
'actions' => Action::query()->with(['decisions', 'segment'])->get(),
|
||||
'decisions' => Decision::query()->with('actions')->get(),
|
||||
'segments' => Segment::query()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function storeAction(Request $request)
|
||||
{
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'segment_id' => 'nullable|integer|exists:segments,id',
|
||||
'decisions' => 'nullable|array',
|
||||
'decisions.*.id' => 'required_with:decisions.*|integer|exists:decisions,id',
|
||||
'decisions.*.name' => 'required_with:decisions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$decisionIds = collect($attributes['decisions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $decisionIds) {
|
||||
/** @var \App\Models\Action $row */
|
||||
$row = Action::create([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
'segment_id' => $attributes['segment_id'] ?? null,
|
||||
]);
|
||||
|
||||
if (!empty($decisionIds)) {
|
||||
$row->decisions()->sync($decisionIds);
|
||||
}
|
||||
});
|
||||
|
||||
return to_route('settings.workflow')->with('success', 'Action created successfully!');
|
||||
}
|
||||
|
||||
public function updateAction(int $id, Request $request)
|
||||
{
|
||||
$row = Action::findOrFail($id);
|
||||
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'segment_id' => 'nullable|integer|exists:segments,id',
|
||||
'decisions' => 'nullable|array',
|
||||
'decisions.*.id' => 'required_with:decisions.*|integer|exists:decisions,id',
|
||||
'decisions.*.name' => 'required_with:decisions.*|string|max:50'
|
||||
]);
|
||||
|
||||
$decisionIds = collect($attributes['decisions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function() use ($attributes, $decisionIds, $row) {
|
||||
$row->update([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'],
|
||||
'segment_id' => $attributes['segment_id'] ?? null,
|
||||
]);
|
||||
$row->decisions()->sync($decisionIds);
|
||||
});
|
||||
|
||||
return to_route('settings.workflow')->with('success', 'Update successful!');
|
||||
}
|
||||
|
||||
public function storeDecision(Request $request)
|
||||
{
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'actions' => 'nullable|array',
|
||||
'actions.*.id' => 'required_with:actions.*|integer|exists:actions,id',
|
||||
'actions.*.name' => 'required_with:actions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$actionIds = collect($attributes['actions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $actionIds) {
|
||||
/** @var \App\Models\Decision $row */
|
||||
$row = Decision::create([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
]);
|
||||
|
||||
if (!empty($actionIds)) {
|
||||
$row->actions()->sync($actionIds);
|
||||
}
|
||||
});
|
||||
|
||||
return to_route('settings.workflow')->with('success', 'Decision created successfully!');
|
||||
}
|
||||
|
||||
public function updateDecision(int $id, Request $request)
|
||||
{
|
||||
$row = Decision::findOrFail($id);
|
||||
|
||||
$attributes = $request->validate([
|
||||
'name' => 'required|string|max:50',
|
||||
'color_tag' => 'nullable|string|max:25',
|
||||
'actions' => 'nullable|array',
|
||||
'actions.*.id' => 'required_with:actions.*|integer|exists:actions,id',
|
||||
'actions.*.name' => 'required_with:actions.*|string|max:50',
|
||||
]);
|
||||
|
||||
$actionIds = collect($attributes['actions'] ?? [])->pluck('id')->toArray();
|
||||
|
||||
\DB::transaction(function () use ($attributes, $actionIds, $row) {
|
||||
$row->update([
|
||||
'name' => $attributes['name'],
|
||||
'color_tag' => $attributes['color_tag'] ?? null,
|
||||
]);
|
||||
$row->actions()->sync($actionIds);
|
||||
});
|
||||
|
||||
return to_route('settings.workflow')->with('success', 'Decision updated successfully!');
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,12 @@ class GenerateDocumentPreview implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Max seconds this job may run before the worker kills it.
|
||||
* Does not speed up the job, but protects the queue and surfaces timeouts.
|
||||
*/
|
||||
public $timeout = 180; // 3 minutes
|
||||
|
||||
public function __construct(public int $documentId)
|
||||
{
|
||||
}
|
||||
|
|
@ -30,6 +36,22 @@ public function handle(): void
|
|||
return;
|
||||
|
||||
$ext = strtolower(pathinfo($doc->original_name ?: $doc->file_name, PATHINFO_EXTENSION));
|
||||
|
||||
// If a preview was already generated after the document was last updated, skip re-generation
|
||||
if ($doc->preview_generated_at && $doc->updated_at && $doc->preview_path) {
|
||||
$previewDisk = config('files.preview_disk', 'public');
|
||||
if (Storage::disk($previewDisk)->exists($doc->preview_path)) {
|
||||
if ($doc->updated_at->lte($doc->preview_generated_at)) {
|
||||
Log::info('Skipping preview generation (already up to date)', [
|
||||
'document_id' => $doc->id,
|
||||
'preview_path' => $doc->preview_path,
|
||||
'updated_at' => (string) $doc->updated_at,
|
||||
'preview_generated_at' => (string) $doc->preview_generated_at,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!in_array($ext, ['doc', 'docx']))
|
||||
return; // only convert office docs here
|
||||
|
||||
|
|
@ -53,6 +75,14 @@ public function handle(): void
|
|||
// Run soffice headless to convert to PDF
|
||||
$binCfg = config('files.libreoffice_bin');
|
||||
$bin = $binCfg ? (string) $binCfg : 'soffice';
|
||||
// If an absolute path is configured, ensure it exists to avoid long PATH resolution delays
|
||||
if ($binCfg && preg_match('/^[a-zA-Z]:\\\\|^\//', $bin) && !file_exists($bin)) {
|
||||
Log::warning('Configured LibreOffice binary not found; falling back to PATH', [
|
||||
'document_id' => $doc->id,
|
||||
'bin' => $bin,
|
||||
]);
|
||||
$bin = 'soffice';
|
||||
}
|
||||
// Windows quoting differs from POSIX. Build command parts safely.
|
||||
$isWin = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
|
||||
if ($isWin) {
|
||||
|
|
@ -81,6 +111,7 @@ public function handle(): void
|
|||
|
||||
// Capture stderr as well for diagnostics
|
||||
$cmdWithStderr = $cmd . ' 2>&1';
|
||||
$t0 = microtime(true);
|
||||
Log::info('Starting LibreOffice preview conversion', [
|
||||
'document_id' => $doc->id,
|
||||
'cmd' => $cmd,
|
||||
|
|
@ -99,6 +130,7 @@ public function handle(): void
|
|||
@unlink($tmpIn);
|
||||
return;
|
||||
}
|
||||
$elapsed = (int) round((microtime(true) - $t0) * 1000);
|
||||
|
||||
$pdfPathLocal = $tmpIn . '.pdf';
|
||||
// LibreOffice writes output with source filename base; derive path
|
||||
|
|
@ -133,6 +165,11 @@ public function handle(): void
|
|||
$doc->preview_mime = 'application/pdf';
|
||||
$doc->preview_generated_at = now();
|
||||
$doc->save();
|
||||
Log::info('Preview generated and stored', [
|
||||
'document_id' => $doc->id,
|
||||
'preview_path' => $doc->preview_path,
|
||||
'elapsed_ms' => $elapsed,
|
||||
]);
|
||||
}
|
||||
|
||||
@unlink($tmpIn);
|
||||
|
|
|
|||
42
app/Models/FieldJob.php
Normal file
42
app/Models/FieldJob.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class FieldJob extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'field_job_setting_id',
|
||||
'asigned_user_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
|
||||
protected static function booted(){
|
||||
static::creating(function (FieldJob $fieldJob) {
|
||||
if(!isset($fieldJob->user_id)){
|
||||
$fieldJob->user_id = auth()->id();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function setting(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FieldJobSetting::class, 'field_job_setting_id');
|
||||
}
|
||||
|
||||
public function assignedUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'asigned_user_id');
|
||||
}
|
||||
}
|
||||
39
app/Models/FieldJobSetting.php
Normal file
39
app/Models/FieldJobSetting.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class FieldJobSetting extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'segment_id',
|
||||
'asign_decision_id',
|
||||
'complete_decision_id',
|
||||
];
|
||||
|
||||
public function segment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Segment::class);
|
||||
}
|
||||
|
||||
public function asignDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'asign_decision_id');
|
||||
}
|
||||
|
||||
public function completeDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'complete_decision_id');
|
||||
}
|
||||
|
||||
public function fieldJobs(): HasMany
|
||||
{
|
||||
return $this->hasMany(FieldJob::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('field_job_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('segment_id')->nullable()->constrained('segments')->nullOnDelete();
|
||||
$table->foreignId('initial_decision_id')->nullable()->constrained('decisions')->nullOnDelete();
|
||||
$table->foreignId('asign_decision_id')->nullable()->constrained('decisions')->nullOnDelete();
|
||||
$table->foreignId('complete_decision_id')->nullable()->constrained('decisions')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('field_job_settings');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('field_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('field_job_setting_id')->constrained('field_job_settings')->cascadeOnDelete();
|
||||
$table->foreignId('asigned_user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->date('assigned_at')->nullable();
|
||||
$table->date('completed_at')->nullable();
|
||||
$table->date('cancelled_at')->nullable();
|
||||
$table->boolean('priority')->default(false);
|
||||
$table->string('notes', 255)->nullable();
|
||||
$table->jsonb('address_snapshot ')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('field_jobs');
|
||||
}
|
||||
};
|
||||
|
|
@ -84,7 +84,8 @@ const store = () => {
|
|||
},
|
||||
onSuccess: () => {
|
||||
close();
|
||||
form.reset();
|
||||
// Preserve selected contract across submissions; reset only user-editable fields
|
||||
form.reset('due_date', 'amount', 'note');
|
||||
},
|
||||
onError: (errors) => {
|
||||
console.log('Validation or server error:', errors);
|
||||
|
|
@ -95,6 +96,17 @@ const store = () => {
|
|||
});
|
||||
}
|
||||
|
||||
// When the drawer opens, always sync the current contractUuid into the form,
|
||||
// even if the value hasn't changed (prevents stale/null contract_uuid after reset)
|
||||
watch(
|
||||
() => props.show,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
form.contract_uuid = props.contractUuid || null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<DialogModal :show="show" @close="close">
|
||||
|
|
|
|||
46
resources/js/Pages/Settings/FieldJob/Index.vue
Normal file
46
resources/js/Pages/Settings/FieldJob/Index.vue
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<script setup>
|
||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
|
||||
const props = defineProps({
|
||||
settings: Array,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Field Job Settings">
|
||||
<template #header></template>
|
||||
<div class="pt-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h3 class="text-lg font-semibold mb-2">Segments</h3>
|
||||
<p class="text-sm text-gray-600 mb-4">Manage segments used across the app.</p>
|
||||
<Link :href="route('settings.segments')" class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700">Open Segments</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Field Job Settings</h2>
|
||||
<table class="min-w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr class="border-b">
|
||||
<th class="py-2 pr-4">ID</th>
|
||||
<th class="py-2 pr-4">Segment</th>
|
||||
<th class="py-2 pr-4">Assign Decision</th>
|
||||
<th class="py-2 pr-4">Complete Decision</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in settings" :key="row.id" class="border-b last:border-0">
|
||||
<td class="py-2 pr-4">{{ row.id }}</td>
|
||||
<td class="py-2 pr-4">{{ row.segment?.name }}</td>
|
||||
<td class="py-2 pr-4">{{ row.asign_decision?.name || row.asignDecision?.name }}</td>
|
||||
<td class="py-2 pr-4">{{ row.complete_decision?.name || row.completeDecision?.name }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
@ -1,33 +1,29 @@
|
|||
<script setup>
|
||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
import { ref } from 'vue';
|
||||
import { FwbTab, FwbTabs } from 'flowbite-vue'
|
||||
import ActionTable from './Partials/ActionTable.vue';
|
||||
import DecisionTable from './Partials/DecisionTable.vue';
|
||||
|
||||
const props = defineProps({
|
||||
actions: Array,
|
||||
decisions: Array,
|
||||
segments: Array
|
||||
});
|
||||
|
||||
const activeTab = ref('actions')
|
||||
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Settings">
|
||||
<template #header></template>
|
||||
<div class="pt-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<fwb-tabs v-model="activeTab" variant="underline" >
|
||||
<fwb-tab name="actions" title="Actions">
|
||||
<ActionTable :actions="actions" :decisions="decisions" :segments="segments" />
|
||||
</fwb-tab>
|
||||
<fwb-tab name="decisions" title="Decisions">
|
||||
<DecisionTable :decisions="decisions" :actions="actions" />
|
||||
</fwb-tab>
|
||||
</fwb-tabs>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h3 class="text-lg font-semibold mb-2">Segments</h3>
|
||||
<p class="text-sm text-gray-600 mb-4">Manage segments used across the app.</p>
|
||||
<Link :href="route('settings.segments')" class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700">Open Segments</Link>
|
||||
</div>
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h3 class="text-lg font-semibold mb-2">Workflow</h3>
|
||||
<p class="text-sm text-gray-600 mb-4">Configure actions and decisions relationships.</p>
|
||||
<Link :href="route('settings.workflow')" class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700">Open Workflow</Link>
|
||||
</div>
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h3 class="text-lg font-semibold mb-2">Field Job Settings</h3>
|
||||
<p class="text-sm text-gray-600 mb-4">Configure segment-based field job rules.</p>
|
||||
<Link :href="route('settings.fieldjob.index')" class="inline-flex items-center px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700">Open Field Job</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
23
resources/js/Pages/Settings/Segments/Index.vue
Normal file
23
resources/js/Pages/Settings/Segments/Index.vue
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<script setup>
|
||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
|
||||
const props = defineProps({
|
||||
segments: Array,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout title="Segments">
|
||||
<template #header></template>
|
||||
<div class="pt-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Segments</h2>
|
||||
<ul class="list-disc list-inside">
|
||||
<li v-for="s in segments" :key="s.id">{{ s.name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
35
resources/js/Pages/Settings/Workflow/Index.vue
Normal file
35
resources/js/Pages/Settings/Workflow/Index.vue
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<script setup>
|
||||
import AppLayout from '@/Layouts/AppLayout.vue';
|
||||
import { ref } from 'vue';
|
||||
import { FwbTab, FwbTabs } from 'flowbite-vue'
|
||||
import ActionTable from '../Partials/ActionTable.vue';
|
||||
import DecisionTable from '../Partials/DecisionTable.vue';
|
||||
|
||||
const props = defineProps({
|
||||
actions: Array,
|
||||
decisions: Array,
|
||||
segments: Array
|
||||
});
|
||||
|
||||
const activeTab = ref('actions')
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<AppLayout title="Workflow">
|
||||
<template #header></template>
|
||||
<div class="pt-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
|
||||
<fwb-tabs v-model="activeTab" variant="underline" >
|
||||
<fwb-tab name="actions" title="Actions">
|
||||
<ActionTable :actions="actions" :decisions="decisions" :segments="segments" />
|
||||
</fwb-tab>
|
||||
<fwb-tab name="decisions" title="Decisions">
|
||||
<DecisionTable :decisions="decisions" :actions="actions" />
|
||||
</fwb-tab>
|
||||
</fwb-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
@ -6,6 +6,9 @@
|
|||
use App\Http\Controllers\ClientController;
|
||||
use App\Http\Controllers\ContractController;
|
||||
use App\Http\Controllers\SettingController;
|
||||
use App\Http\Controllers\WorkflowController;
|
||||
use App\Http\Controllers\SegmentController;
|
||||
use App\Http\Controllers\FieldJobSettingController;
|
||||
use App\Http\Controllers\ImportController;
|
||||
use App\Http\Controllers\ImportTemplateController;
|
||||
use App\Http\Controllers\CaseObjectController;
|
||||
|
|
@ -132,10 +135,13 @@
|
|||
Route::get('client-cases/{client_case:uuid}/documents/{document:uuid}/download', [ClientCaseContoller::class, 'downloadDocument'])->name('clientCase.document.download');
|
||||
//settings
|
||||
Route::get('settings', [SettingController::class, 'index'])->name('settings');
|
||||
Route::post('settings/actions', [SettingController::class, 'storeAction'])->name('settings.actions.store');
|
||||
Route::put('settings/actions/{id}', [SettingController::class, 'updateAction'])->name('settings.actions.update');
|
||||
Route::post('settings/decisions', [SettingController::class, 'storeDecision'])->name('settings.decisions.store');
|
||||
Route::put('settings/decisions/{id}', [SettingController::class, 'updateDecision'])->name('settings.decisions.update');
|
||||
Route::get('settings/segments', [SegmentController::class, 'settings'])->name('settings.segments');
|
||||
Route::get('settings/workflow', [WorkflowController::class, 'index'])->name('settings.workflow');
|
||||
Route::get('settings/field-job', [FieldJobSettingController::class, 'index'])->name('settings.fieldjob.index');
|
||||
Route::post('settings/actions', [WorkflowController::class, 'storeAction'])->name('settings.actions.store');
|
||||
Route::put('settings/actions/{id}', [WorkflowController::class, 'updateAction'])->name('settings.actions.update');
|
||||
Route::post('settings/decisions', [WorkflowController::class, 'storeDecision'])->name('settings.decisions.store');
|
||||
Route::put('settings/decisions/{id}', [WorkflowController::class, 'updateDecision'])->name('settings.decisions.update');
|
||||
|
||||
// imports
|
||||
Route::get('imports/create', [ImportController::class, 'create'])->name('imports.create');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user