diff --git a/CHANGELOG.md b/CHANGELOG.md index c284665..f25c8c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,32 +2,35 @@ ## Unreleased +### Changed (breaking rename) +- The package is now **Rehla**, matching its repository. It was named "Rihla" during pre-release development. Composer name `elbanbydev/rehla`, namespace `Rehla\`, config `config/rehla.php`, language namespace `rehla::`, facade `Rehla`, tables `rehla_*`, models `Rehla*`, env vars `REHLA_*`, routes `rehla.*`. Nothing was ever tagged or published under the old name, so there is no upgrade path to support. + ### Fixed - History popup text follows its own direction (mixed Arabic/English messages), and the (i) button no longer wraps under the follow-up time. ### Added -- The WhatsApp modal warns when the user was followed up within `rihla.follow_up.warn_within_hours` (default 24, 0 turns it off). It never blocks sending. +- The WhatsApp modal warns when the user was followed up within `rehla.follow_up.warn_within_hours` (default 24, 0 turns it off). It never blocks sending. ## v0.4.0 - 2026-12-03 ### Added -- Follow-up tracking: when the admin confirms the WhatsApp modal, Rihla records who followed up, when, the exact message sent, and the template/journey/step it was about (template title snapshotted, so history survives template edits and deletions). +- Follow-up tracking: when the admin confirms the WhatsApp modal, Rehla records who followed up, when, the exact message sent, and the template/journey/step it was about (template title snapshotted, so history survives template edits and deletions). - "Last follow-up" column in the panel table, next to "Last visit", so no two admins message the same user twice. - An (i) button per row opens the follow-up history popup: every recorded message to that user, newest first (up to 50), with sender, time and subject. -- Recording and history endpoints live behind the same panel Gate; `Rihla::forget($user)` now removes follow-up records too. +- Recording and history endpoints live behind the same panel Gate; `Rehla::forget($user)` now removes follow-up records too. ## v0.3.1 - 2026-12-03 ### Added -- `rihla:report` artisan command: per-journey table of how many users completed, started, or never started each step. +- `rehla:report` artisan command: per-journey table of how many users completed, started, or never started each step. ## v0.3.0 - 2026-12-03 ### Added - `{name}` placeholder in template content, replaced with the user's name when the modal fills the message. - "Last visit" column in the panel table (relative time, or "Never"). -- `Rihla::forget($user)`: delete a user's progress and visit records, for account deletion cleanup. +- `Rehla::forget($user)`: delete a user's progress and visit records, for account deletion cleanup. ## v0.2.0 - 2026-12-03 @@ -36,7 +39,7 @@ - The complete transition is now won with one atomic `UPDATE ... WHERE status = 'started'`, so two concurrent completes cannot both fire `StepCompleted`. - `touch()` (visit tracking) swallows the duplicate-key race instead of erroring a normal page view. - Dashboard join/order by the user model's actual key name instead of a hardcoded `id`. -- Clear `ConfigurationException` when `rihla.user_model` points at a missing class. +- Clear `ConfigurationException` when `rehla.user_model` points at a missing class. - wa.me numbers shorter than 8 digits are rejected as undialable instead of producing a broken link. ## v0.1.0 - 2026-12-03 @@ -44,10 +47,10 @@ First public build. ### Added -- Journey + step definitions in config (`rihla.journeys`), ordered; "not started" derived from that order. -- Tracking API (`Rihla::start/complete/reset/progress`), idempotent transitions, `StepStarted`/`StepCompleted` events. -- Last-visit tracking via the `rihla.activity` middleware alias, throttled writes, guests ignored. -- Admin panel at `/rihla` (Gate-closed by default): per-user table with the three journey columns, journey tabs, pagination, and the "no visit for at least N day(s)" filter (0 = everyone; never-visited users count from registration). +- Journey + step definitions in config (`rehla.journeys`), ordered; "not started" derived from that order. +- Tracking API (`Rehla::start/complete/reset/progress`), idempotent transitions, `StepStarted`/`StepCompleted` events. +- Last-visit tracking via the `rehla.activity` middleware alias, throttled writes, guests ignored. +- Admin panel at `/rehla` (Gate-closed by default): per-user table with the three journey columns, journey tabs, pagination, and the "no visit for at least N day(s)" filter (0 = everyone; never-visited users count from registration). - WhatsApp re-engagement modal per user row: name, normalised wa.me number, template dropdown, prefilled editable message, confirm opens `wa.me` in a new tab. - Message templates CRUD: title + content, optional journey/step binding, `encourage_continue` / `encourage_start` types. - Smart default selection: the in-progress step's continue template, otherwise the next not-started step's start template; admin override always possible. diff --git a/README.md b/README.md index e22c4a0..eb50689 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Rihla (رحلة) +# Rehla (رحلة) Track where every user is in your site's journey, and bring back the ones who stall. بالعربي: [docs/ar/README.md](docs/ar/README.md) -Some sites are not a pile of pages; they are a journey. The user creates an account, completes a profile, places a first order — defined steps, one after another. Rihla records where each user stands and gives the admin one table that always answers three questions: +Some sites are not a pile of pages; they are a journey. The user creates an account, completes a profile, places a first order — defined steps, one after another. Rehla records where each user stands and gives the admin one table that always answers three questions: 1. Which steps did this user **finish**? 2. Which steps did they **start but never finish**? @@ -22,14 +22,14 @@ On top of that table sits a re-engagement flow: a WhatsApp button per user that ## Installation ```bash -composer require elbanbydev/rihla -php artisan vendor:publish --tag=rihla-config +composer require elbanbydev/rehla +php artisan vendor:publish --tag=rehla-config php artisan migrate ``` ## Define your journey -In `config/rihla.php`: +In `config/rehla.php`: ```php 'journeys' => [ @@ -49,20 +49,20 @@ Steps are ordered. "Not started" is derived from this order: any step the user h ## Track progress ```php -use Rihla\Facades\Rihla; +use Rehla\Facades\Rehla; -Rihla::start($user, 'profile'); // user began the step -Rihla::complete($user, 'profile'); // user finished it -Rihla::reset($user, step: 'profile'); // forget one step -Rihla::reset($user); // forget the whole journey +Rehla::start($user, 'profile'); // user began the step +Rehla::complete($user, 'profile'); // user finished it +Rehla::reset($user, step: 'profile'); // forget one step +Rehla::reset($user); // forget the whole journey -$summary = Rihla::progress($user); +$summary = Rehla::progress($user); $summary->completedSteps; // ['account'] $summary->startedSteps; // ['profile'] $summary->notStartedSteps; // ['first-order'] ``` -All transitions are idempotent: starting a started step (or completing a completed one) changes nothing and fires no event. Completing a step that was never started stamps both dates. Events `Rihla\Events\StepStarted` and `Rihla\Events\StepCompleted` fire on real transitions only. +All transitions are idempotent: starting a started step (or completing a completed one) changes nothing and fires no event. Completing a step that was never started stamps both dates. Events `Rehla\Events\StepStarted` and `Rehla\Events\StepCompleted` fire on real transitions only. ## Track the last visit @@ -70,41 +70,41 @@ The "days absent" filter needs to know when each user was last seen. Add the mid ```php ->withMiddleware(function (Middleware $middleware) { - $middleware->appendToGroup('web', [\Rihla\Http\Middleware\RecordActivity::class]); + $middleware->appendToGroup('web', [\Rehla\Http\Middleware\RecordActivity::class]); }) ``` -or by its alias `rihla.activity`. Every authenticated request refreshes the user's `last_seen_at`, throttled by `rihla.activity.throttle_seconds` (default 300) so a busy session costs at most one write per window. Guests are never tracked. +or by its alias `rehla.activity`. Every authenticated request refreshes the user's `last_seen_at`, throttled by `rehla.activity.throttle_seconds` (default 300) so a busy session costs at most one write per window. Guests are never tracked. ## Open the panel -The panel stays closed until you name a Gate ability in `rihla.panel.gate` (default `viewRihla`) and define it: +The panel stays closed until you name a Gate ability in `rehla.panel.gate` (default `viewRehla`) and define it: ```php -Gate::define('viewRihla', fn (User $user) => $user->isAdmin()); +Gate::define('viewRehla', fn (User $user) => $user->isAdmin()); ``` -Then visit `/rihla` (path configurable). The table shows, per user: name, your configured columns (`rihla.user_columns`, e.g. email, role), and the three journey columns as badges. The filter above the table reads "no visit for at least N day(s)": +Then visit `/rehla` (path configurable). The table shows, per user: name, your configured columns (`rehla.user_columns`, e.g. email, role), and the three journey columns as badges. The filter above the table reads "no visit for at least N day(s)": - **0** shows everyone, even someone who registered seconds ago. - **N** shows only users with no recorded visit in the last N days. A user with no visit at all counts from their registration date. ## WhatsApp re-engagement -Each row with a phone number gets a WhatsApp button. The modal shows the user's name, the destination number (normalised to wa.me digits: local `0107…` becomes `20107…` via `rihla.whatsapp.default_country_code`), a template dropdown, and the message. Confirming opens `https://wa.me/?text=` in a new tab — nothing is sent without a human clicking send in WhatsApp. +Each row with a phone number gets a WhatsApp button. The modal shows the user's name, the destination number (normalised to wa.me digits: local `0107…` becomes `20107…` via `rehla.whatsapp.default_country_code`), a template dropdown, and the message. Confirming opens `https://wa.me/?text=` in a new tab — nothing is sent without a human clicking send in WhatsApp. -Templates are managed at `/rihla/templates`: title + content, plus an optional binding to a specific step of a journey and one of two types: +Templates are managed at `/rehla/templates`: title + content, plus an optional binding to a specific step of a journey and one of two types: - **Encourage to continue the step** — pre-selected when the user has that step started but unfinished. - **Encourage to start the step** — pre-selected for the next never-started step, when the user has nothing in progress. The modal pre-selects by that rule (most recently updated matching template wins) and the admin can always pick another template or edit the text before opening WhatsApp. Templates with no step binding are never auto-selected. -Set `rihla.phone_attribute` (default `phone`) and `rihla.name_attribute` (default `name`) to match your user model. The placeholder `{name}` inside a template's content is replaced with the user's name when the modal fills the message. +Set `rehla.phone_attribute` (default `phone`) and `rehla.name_attribute` (default `name`) to match your user model. The placeholder `{name}` inside a template's content is replaced with the user's name when the modal fills the message. ## Follow-up tracking -When several people have follow-up permission, nobody should message the same user twice. So Rihla records every follow-up the moment the admin confirms the WhatsApp modal: who sent it, when, the exact message, and what it was about (the template title is snapshotted, so the record survives template edits and deletions). +When several people have follow-up permission, nobody should message the same user twice. So Rehla records every follow-up the moment the admin confirms the WhatsApp modal: who sent it, when, the exact message, and what it was about (the template title is snapshotted, so the record survives template edits and deletions). The table's **Last follow-up** column sits next to **Last visit**, and each row's **(i)** button opens the full history popup: every message ever sent to that user, newest first. Recording is best-effort and never blocks opening WhatsApp. @@ -113,14 +113,14 @@ The table's **Last follow-up** column sits next to **Last visit**, and each row' When your app deletes a user, drop their journey data too: ```php -Rihla::forget($user); // removes progress rows and the visit record +Rehla::forget($user); // removes progress rows and the visit record ``` ## Artisan report ```bash -php artisan rihla:report # every journey -php artisan rihla:report onboarding # one journey +php artisan rehla:report # every journey +php artisan rehla:report onboarding # one journey ``` Prints, per step: how many users completed it, started it without finishing, and never started it. diff --git a/composer.json b/composer.json index b4484df..8149754 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "elbanbydev/rihla", - "description": "Rihla (رحلة) - track where every user is in your site's journey: which steps they finished, which they started but never finished, and which they never touched, with a WhatsApp re-engagement panel. Experimental.", + "name": "elbanbydev/rehla", + "description": "Rehla (رحلة) - track where every user is in your site's journey: which steps they finished, which they started but never finished, and which they never touched, with a WhatsApp re-engagement panel. Experimental.", "keywords": [ "laravel", "user-journey", @@ -9,7 +9,7 @@ "user-progress", "whatsapp", "egypt", - "rihla" + "rehla" ], "license": "MIT", "require": { @@ -30,21 +30,21 @@ }, "autoload": { "psr-4": { - "Rihla\\": "src/" + "Rehla\\": "src/" } }, "autoload-dev": { "psr-4": { - "Rihla\\Tests\\": "tests/" + "Rehla\\Tests\\": "tests/" } }, "extra": { "laravel": { "providers": [ - "Rihla\\RihlaServiceProvider" + "Rehla\\RehlaServiceProvider" ], "aliases": { - "Rihla": "Rihla\\Facades\\Rihla" + "Rehla": "Rehla\\Facades\\Rehla" } } }, diff --git a/config/rihla.php b/config/rehla.php similarity index 84% rename from config/rihla.php rename to config/rehla.php index a636410..069576c 100644 --- a/config/rihla.php +++ b/config/rehla.php @@ -5,10 +5,10 @@ return [ /* - | The Eloquent model that moves through the journey. Rihla never + | The Eloquent model that moves through the journey. Rehla never | migrates this model's table; it keeps its own tables instead. */ - 'user_model' => env('RIHLA_USER_MODEL', 'App\\Models\\User'), + 'user_model' => env('REHLA_USER_MODEL', 'App\\Models\\User'), /* | Attributes used in the panel: the display name and the WhatsApp @@ -44,7 +44,7 @@ ], /* - | Last-visit tracking. Add the `rihla.activity` middleware alias to + | Last-visit tracking. Add the `rehla.activity` middleware alias to | your web (and/or api) middleware group. Writes are throttled so a | busy user costs at most one write per throttle window. */ @@ -56,13 +56,13 @@ /* | The admin panel. It stays closed (403) until you name a Gate | ability in `panel.gate` and define it in your AuthServiceProvider: - | Gate::define('viewRihla', fn (User $user) => $user->isAdmin()); + | Gate::define('viewRehla', fn (User $user) => $user->isAdmin()); */ 'panel' => [ 'enabled' => true, - 'path' => 'rihla', + 'path' => 'rehla', 'middleware' => ['web'], - 'gate' => 'viewRihla', + 'gate' => 'viewRehla', ], /* @@ -79,7 +79,7 @@ | without "+". Local numbers (leading 0) get the country code. */ 'whatsapp' => [ - 'default_country_code' => env('RIHLA_WHATSAPP_COUNTRY_CODE', '20'), + 'default_country_code' => env('REHLA_WHATSAPP_COUNTRY_CODE', '20'), ], ]; diff --git a/database/migrations/2026_01_01_000001_create_rihla_step_progress_table.php b/database/migrations/2026_01_01_000001_create_rehla_step_progress_table.php similarity index 77% rename from database/migrations/2026_01_01_000001_create_rihla_step_progress_table.php rename to database/migrations/2026_01_01_000001_create_rehla_step_progress_table.php index 56c76ca..64f8ce5 100644 --- a/database/migrations/2026_01_01_000001_create_rihla_step_progress_table.php +++ b/database/migrations/2026_01_01_000001_create_rehla_step_progress_table.php @@ -10,7 +10,7 @@ { public function up(): void { - Schema::create('rihla_step_progress', function (Blueprint $table): void { + Schema::create('rehla_step_progress', function (Blueprint $table): void { $table->id(); $table->string('trackable_type'); $table->unsignedBigInteger('trackable_id'); @@ -21,13 +21,13 @@ public function up(): void $table->timestamp('completed_at')->nullable(); $table->timestamps(); - $table->unique(['trackable_type', 'trackable_id', 'journey', 'step'], 'rihla_progress_unique'); - $table->index(['journey', 'step'], 'rihla_progress_step_index'); + $table->unique(['trackable_type', 'trackable_id', 'journey', 'step'], 'rehla_progress_unique'); + $table->index(['journey', 'step'], 'rehla_progress_step_index'); }); } public function down(): void { - Schema::dropIfExists('rihla_step_progress'); + Schema::dropIfExists('rehla_step_progress'); } }; diff --git a/database/migrations/2026_01_01_000002_create_rihla_activity_table.php b/database/migrations/2026_01_01_000002_create_rehla_activity_table.php similarity index 74% rename from database/migrations/2026_01_01_000002_create_rihla_activity_table.php rename to database/migrations/2026_01_01_000002_create_rehla_activity_table.php index 7ea8f2d..88d0f1f 100644 --- a/database/migrations/2026_01_01_000002_create_rihla_activity_table.php +++ b/database/migrations/2026_01_01_000002_create_rehla_activity_table.php @@ -10,20 +10,20 @@ { public function up(): void { - Schema::create('rihla_activity', function (Blueprint $table): void { + Schema::create('rehla_activity', function (Blueprint $table): void { $table->id(); $table->string('trackable_type'); $table->unsignedBigInteger('trackable_id'); $table->timestamp('last_seen_at'); $table->timestamps(); - $table->unique(['trackable_type', 'trackable_id'], 'rihla_activity_unique'); - $table->index('last_seen_at', 'rihla_activity_last_seen_index'); + $table->unique(['trackable_type', 'trackable_id'], 'rehla_activity_unique'); + $table->index('last_seen_at', 'rehla_activity_last_seen_index'); }); } public function down(): void { - Schema::dropIfExists('rihla_activity'); + Schema::dropIfExists('rehla_activity'); } }; diff --git a/database/migrations/2026_01_01_000003_create_rihla_templates_table.php b/database/migrations/2026_01_01_000003_create_rehla_templates_table.php similarity index 77% rename from database/migrations/2026_01_01_000003_create_rihla_templates_table.php rename to database/migrations/2026_01_01_000003_create_rehla_templates_table.php index f379901..44775c9 100644 --- a/database/migrations/2026_01_01_000003_create_rihla_templates_table.php +++ b/database/migrations/2026_01_01_000003_create_rehla_templates_table.php @@ -10,7 +10,7 @@ { public function up(): void { - Schema::create('rihla_templates', function (Blueprint $table): void { + Schema::create('rehla_templates', function (Blueprint $table): void { $table->id(); $table->string('title'); $table->text('content'); @@ -19,12 +19,12 @@ public function up(): void $table->string('type', 24); $table->timestamps(); - $table->index(['journey', 'step', 'type'], 'rihla_templates_lookup'); + $table->index(['journey', 'step', 'type'], 'rehla_templates_lookup'); }); } public function down(): void { - Schema::dropIfExists('rihla_templates'); + Schema::dropIfExists('rehla_templates'); } }; diff --git a/database/migrations/2026_01_01_000004_create_rihla_follow_ups_table.php b/database/migrations/2026_01_01_000004_create_rehla_follow_ups_table.php similarity index 86% rename from database/migrations/2026_01_01_000004_create_rihla_follow_ups_table.php rename to database/migrations/2026_01_01_000004_create_rehla_follow_ups_table.php index c2eede0..91c352d 100644 --- a/database/migrations/2026_01_01_000004_create_rihla_follow_ups_table.php +++ b/database/migrations/2026_01_01_000004_create_rehla_follow_ups_table.php @@ -10,7 +10,7 @@ { public function up(): void { - Schema::create('rihla_follow_ups', function (Blueprint $table): void { + Schema::create('rehla_follow_ups', function (Blueprint $table): void { $table->id(); $table->string('trackable_type'); $table->unsignedBigInteger('trackable_id'); @@ -25,12 +25,12 @@ public function up(): void $table->string('channel', 24)->default('whatsapp'); $table->timestamps(); - $table->index(['trackable_type', 'trackable_id', 'created_at'], 'rihla_followups_user_index'); + $table->index(['trackable_type', 'trackable_id', 'created_at'], 'rehla_followups_user_index'); }); } public function down(): void { - Schema::dropIfExists('rihla_follow_ups'); + Schema::dropIfExists('rehla_follow_ups'); } }; diff --git a/docs/ar/README.md b/docs/ar/README.md index 13e89ad..61b677c 100644 --- a/docs/ar/README.md +++ b/docs/ar/README.md @@ -1,4 +1,4 @@ -# رحلة (Rihla) +# رحلة (Rehla) اعرف كل مستخدم واقف فين في رحلة موقعك، ورجّع اللي وقف في النص. @@ -22,14 +22,14 @@ ## التثبيت ```bash -composer require elbanbydev/rihla -php artisan vendor:publish --tag=rihla-config +composer require elbanbydev/rehla +php artisan vendor:publish --tag=rehla-config php artisan migrate ``` ## عرّف الرحلة بتاعتك -في `config/rihla.php`: +في `config/rehla.php`: ```php 'journeys' => [ @@ -49,20 +49,20 @@ php artisan migrate ## تتبّع التقدم ```php -use Rihla\Facades\Rihla; +use Rehla\Facades\Rehla; -Rihla::start($user, 'profile'); // المستخدم بدأ الخطوة -Rihla::complete($user, 'profile'); // المستخدم خلّصها -Rihla::reset($user, step: 'profile'); // انسَ خطوة واحدة -Rihla::reset($user); // انسَ الرحلة كلها +Rehla::start($user, 'profile'); // المستخدم بدأ الخطوة +Rehla::complete($user, 'profile'); // المستخدم خلّصها +Rehla::reset($user, step: 'profile'); // انسَ خطوة واحدة +Rehla::reset($user); // انسَ الرحلة كلها -$summary = Rihla::progress($user); +$summary = Rehla::progress($user); $summary->completedSteps; // ['account'] $summary->startedSteps; // ['profile'] $summary->notStartedSteps; // ['first-order'] ``` -كل التحولات idempotent: بدء خطوة مبدوءة (أو إكمال مكتملة) مبيغيرش حاجة ومبيطلعش حدث. إكمال خطوة مابدأتش بيسجّل التاريخين. الحدثان `Rihla\Events\StepStarted` و`Rihla\Events\StepCompleted` بيطلعوا عند التحول الحقيقي بس. +كل التحولات idempotent: بدء خطوة مبدوءة (أو إكمال مكتملة) مبيغيرش حاجة ومبيطلعش حدث. إكمال خطوة مابدأتش بيسجّل التاريخين. الحدثان `Rehla\Events\StepStarted` و`Rehla\Events\StepCompleted` بيطلعوا عند التحول الحقيقي بس. ## تتبّع آخر زيارة @@ -70,37 +70,37 @@ $summary->notStartedSteps; // ['first-order'] ```php ->withMiddleware(function (Middleware $middleware) { - $middleware->appendToGroup('web', [\Rihla\Http\Middleware\RecordActivity::class]); + $middleware->appendToGroup('web', [\Rehla\Http\Middleware\RecordActivity::class]); }) ``` -أو بالاسم المختصر `rihla.activity`. أي طلب من مستخدم مسجّل بيحدّث `last_seen_at`، مع خنق (throttle) من `rihla.activity.throttle_seconds` (افتراضياً 300) عشان الجلسة النشيطة متكلفش أكتر من كتابة واحدة في الفترة. الزوار غير المسجلين مبيتتبعوش. +أو بالاسم المختصر `rehla.activity`. أي طلب من مستخدم مسجّل بيحدّث `last_seen_at`، مع خنق (throttle) من `rehla.activity.throttle_seconds` (افتراضياً 300) عشان الجلسة النشيطة متكلفش أكتر من كتابة واحدة في الفترة. الزوار غير المسجلين مبيتتبعوش. ## افتح اللوحة -اللوحة مقفولة لحد ما تسمّي صلاحية Gate في `rihla.panel.gate` (الافتراضي `viewRihla`) وتعرّفها: +اللوحة مقفولة لحد ما تسمّي صلاحية Gate في `rehla.panel.gate` (الافتراضي `viewRehla`) وتعرّفها: ```php -Gate::define('viewRihla', fn (User $user) => $user->isAdmin()); +Gate::define('viewRehla', fn (User $user) => $user->isAdmin()); ``` -وبعدين افتح `/rihla` (المسار قابل للتغيير). الجدول بيعرض لكل مستخدم: الاسم، وأعمدة تانية تختارها (`rihla.user_columns` زي الإيميل والدور)، والأعمدة الثلاثة بتاعة الرحلة كشارات ملونة. الفلتر فوق الجدول معناه «لم يزر الموقع منذ N يوم»: +وبعدين افتح `/rehla` (المسار قابل للتغيير). الجدول بيعرض لكل مستخدم: الاسم، وأعمدة تانية تختارها (`rehla.user_columns` زي الإيميل والدور)، والأعمدة الثلاثة بتاعة الرحلة كشارات ملونة. الفلتر فوق الجدول معناه «لم يزر الموقع منذ N يوم»: - **صفر** بيعرض الكل، حتى لواحد سجّل من ثواني. - **N** بيعرض بس اللي مفيش ليهم زيارة مسجلة في آخر N يوم. اللي ماعملوش أي زيارة بيتحسب من تاريخ التسجيل. ## إعادة التواصل عبر واتساب -كل صف ليه رقم بياخد زرار واتساب. النافذة بتعرض اسم المستخدم، الرقم (بيتحوّل لصيغة wa.me: الرقم المحلي `0107…` بيبقى `20107…` عن طريق `rihla.whatsapp.default_country_code`)، وقائمة القوالب، ونص الرسالة. التأكيد بيفتح `https://wa.me/<الرقم>?text=<الرسالة>` في تاب جديد — مفيش رسالة بتتبعت غير لما إنسان يدوس إرسال جوه واتساب نفسه. +كل صف ليه رقم بياخد زرار واتساب. النافذة بتعرض اسم المستخدم، الرقم (بيتحوّل لصيغة wa.me: الرقم المحلي `0107…` بيبقى `20107…` عن طريق `rehla.whatsapp.default_country_code`)، وقائمة القوالب، ونص الرسالة. التأكيد بيفتح `https://wa.me/<الرقم>?text=<الرسالة>` في تاب جديد — مفيش رسالة بتتبعت غير لما إنسان يدوس إرسال جوه واتساب نفسه. -القوالب بتتدار من `/rihla/templates`: عنوان + محتوى، وربط اختياري بخطوة معينة في رحلة معينة، وواحد من نوعين: +القوالب بتتدار من `/rehla/templates`: عنوان + محتوى، وربط اختياري بخطوة معينة في رحلة معينة، وواحد من نوعين: - **تشجيع على إكمال الخطوة** — بيتختار تلقائياً لما يكون المستخدم بدأ الخطوة دي وماكملهاش. - **تشجيع على بدء الخطوة** — بيتختار لأول خطوة مابدأهاش، لما المستخدم ماعندوش خطوة في النص. النافذة بتختار بالقاعدة دي (أحدث قالب مطابق بيكسب) والأدمن يقدر يختار قالب تاني أو يعدّل النص قبل ما يفتح واتساب. القوالب العامة (غير المرتبطة بخطوة) مبتتختارش تلقائياً أبداً. -ظبط `rihla.phone_attribute` (افتراضياً `phone`) و`rihla.name_attribute` (افتراضياً `name`) على موديل المستخدم بتاعك. ولو كتبت `{name}` جوه نص القالب، بتتبدل باسم المستخدم لما النافذة تملأ الرسالة. +ظبط `rehla.phone_attribute` (افتراضياً `phone`) و`rehla.name_attribute` (افتراضياً `name`) على موديل المستخدم بتاعك. ولو كتبت `{name}` جوه نص القالب، بتتبدل باسم المستخدم لما النافذة تملأ الرسالة. ## تتبّع المتابعة @@ -113,14 +113,14 @@ Gate::define('viewRihla', fn (User $user) => $user->isAdmin()); لما التطبيق يمسح مستخدم، امسح بيانات رحلته كمان: ```php -Rihla::forget($user); // بيمسح سجلات التقدم وآخر زيارة +Rehla::forget($user); // بيمسح سجلات التقدم وآخر زيارة ``` ## تقرير Artisan ```bash -php artisan rihla:report # كل الرحلات -php artisan rihla:report onboarding # رحلة واحدة +php artisan rehla:report # كل الرحلات +php artisan rehla:report onboarding # رحلة واحدة ``` بيطبع لكل خطوة: كام مستخدم خلّصها، وكام بدأها وماكملهاش، وكام مابدأهاش أصلاً. diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 15abf02..b76b855 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,7 +5,7 @@ colors="true" cacheDirectory=".phpunit.cache"> - + tests diff --git a/resources/lang/ar/rihla.php b/resources/lang/ar/rehla.php similarity index 98% rename from resources/lang/ar/rihla.php rename to resources/lang/ar/rehla.php index aece173..8662f81 100644 --- a/resources/lang/ar/rihla.php +++ b/resources/lang/ar/rehla.php @@ -66,7 +66,7 @@ 'encourage_start' => 'تشجيع على بدء الخطوة', ], 'validation' => [ - 'unknown_journey' => 'هذه الرحلة غير معرّفة في إعدادات rihla.journeys.', + 'unknown_journey' => 'هذه الرحلة غير معرّفة في إعدادات rehla.journeys.', 'unknown_user' => 'هذا المستخدم غير موجود.', 'unknown_step' => 'هذه الخطوة غير معرّفة في الرحلة المختارة.', 'step_needs_journey' => 'اختر الرحلة عند ربط القالب بخطوة.', diff --git a/resources/lang/en/rihla.php b/resources/lang/en/rehla.php similarity index 99% rename from resources/lang/en/rihla.php rename to resources/lang/en/rehla.php index 6c09e03..e6f5e4c 100644 --- a/resources/lang/en/rihla.php +++ b/resources/lang/en/rehla.php @@ -66,7 +66,7 @@ 'encourage_start' => 'Encourage to start the step', ], 'validation' => [ - 'unknown_journey' => 'This journey is not defined in the rihla.journeys config.', + 'unknown_journey' => 'This journey is not defined in the rehla.journeys config.', 'unknown_user' => 'This user does not exist.', 'unknown_step' => 'This step is not defined in the chosen journey.', 'step_needs_journey' => 'Choose a journey when the template is tied to a step.', diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 7058a70..6399aeb 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -1,39 +1,39 @@ -@extends('rihla::layout') +@extends('rehla::layout') -@section('title', __('rihla::rihla.panel_title')) +@section('title', __('rehla::rehla.panel_title')) @section('content') @if($journeys->keys() !== [])
@foreach($journeys->keys() as $key) - {{ $journeys->label($key) }} @endforeach
@endif -
+ - + - {{ __('rihla::rihla.days_unit') }} - - {{ __('rihla::rihla.filter_hint') }} + {{ __('rehla::rehla.days_unit') }} + + {{ __('rehla::rehla.filter_hint') }}
- + @foreach($userColumns as $label) @endforeach - - - - - + + + + + @@ -61,17 +61,17 @@ class="{{ $key === $journey ? 'active' : '' }}">{{ $journeys->label($key) }}{{ $steps[$step] ?? $step }} @endforeach - + @empty - + @endforelse @@ -98,67 +98,67 @@ class="{{ $key === $journey ? 'active' : '' }}">{{ $journeys->label($key) }} {{ $users->links() }} -
#{{ __('rihla::rihla.name_column') }}{{ __('rehla::rehla.name_column') }}{{ $label }}{{ __('rihla::rihla.columns.completed') }}{{ __('rihla::rihla.columns.started') }}{{ __('rihla::rihla.columns.not_started') }}{{ __('rihla::rihla.last_visit') }}{{ __('rihla::rihla.last_followup') }}{{ __('rehla::rehla.columns.completed') }}{{ __('rehla::rehla.columns.started') }}{{ __('rehla::rehla.columns.not_started') }}{{ __('rehla::rehla.last_visit') }}{{ __('rehla::rehla.last_followup') }}
{{ $lastSeen[$user->getKey()] ?? null ? $lastSeen[$user->getKey()]->diffForHumans() : __('rihla::rihla.never_seen') }}{{ $lastSeen[$user->getKey()] ?? null ? $lastSeen[$user->getKey()]->diffForHumans() : __('rehla::rehla.never_seen') }} - {{ ($lastFollowUps[$user->getKey()] ?? null) !== null ? $lastFollowUps[$user->getKey()]->diffForHumans() : __('rihla::rihla.never_followup') }} - + title="{{ __('rehla::rehla.history.title') }}">i @if($phones[$user->getKey()] !== null) - @else - @endif
{{ __('rihla::rihla.empty_users') }}{{ __('rehla::rehla.empty_users') }}