Files
clinicpro/migrations/Version20260716102537.php
T
hamedandClaude Opus 4.8 07222826c3 feat: port tauri create-service page as 3-step new-session wizard
Backend:
- Add session_at and inventory_package_id to patient_sessions, new
  session_consumables table (migration Version20260716102537)
- New SessionConsumable entity/repository mirroring SessionService;
  price snapshot, quantity >= 1, tenant-scoped silent skip
- PatientService::createSession accepts session_at, consumables[] and
  inventory_package_uuid; consumables are fully patient-paid (no
  insurance coverage) and added to final_price_rials
- Functional tests: success, foreign-tenant/unknown skip, empty and
  zero-quantity edges (tests/Patient/SessionConsumableTest.php)
- docs/api/patient.md updated for the new Create Session fields

Frontend (admin):
- NewSessionPage rewritten as the tauri /files/create-service 3-step
  wizard (ایجاد سرویس ← پرداخت ← جزییات) using SessionStepper
- New CreateStep: acceptance date/time (Jalali), section/service/staff,
  consumables with counters, package select, conditional insurance
  block (insured service or insured patient profile), price summary
- PaymentStep/DetailsStep extracted from SessionPaymentPage and shared
  between both pages (behavior unchanged, tests still green)
- UserTick and FilesServiceAddCard icons ported verbatim from tauri
- Vitest coverage for the wizard incl. empty-data states

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 14:20:32 +03:30

42 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260716102537 extends AbstractMigration
{
public function getDescription(): string
{
return 'Session wizard parity: session_consumables table, patient_sessions.session_at and inventory_package_id';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE session_consumables (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, price_rials INT NOT NULL, quantity INT NOT NULL, created_at INT NOT NULL, session_id INT NOT NULL, inventory_item_id INT NOT NULL, UNIQUE INDEX UNIQ_6776C347D17F50A6 (uuid), INDEX IDX_6776C347613FECDF (session_id), INDEX IDX_6776C347536BF4A2 (inventory_item_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE session_consumables ADD CONSTRAINT FK_6776C347613FECDF FOREIGN KEY (session_id) REFERENCES patient_sessions (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE session_consumables ADD CONSTRAINT FK_6776C347536BF4A2 FOREIGN KEY (inventory_item_id) REFERENCES inventory_items (id) ON DELETE RESTRICT');
$this->addSql('ALTER TABLE patient_sessions ADD session_at INT DEFAULT NULL, ADD inventory_package_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE patient_sessions ADD CONSTRAINT FK_ADE5C5B6B7A2FE7C FOREIGN KEY (inventory_package_id) REFERENCES inventory_packages (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_ADE5C5B6B7A2FE7C ON patient_sessions (inventory_package_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE session_consumables DROP FOREIGN KEY FK_6776C347613FECDF');
$this->addSql('ALTER TABLE session_consumables DROP FOREIGN KEY FK_6776C347536BF4A2');
$this->addSql('DROP TABLE session_consumables');
$this->addSql('ALTER TABLE patient_sessions DROP FOREIGN KEY FK_ADE5C5B6B7A2FE7C');
$this->addSql('DROP INDEX IDX_ADE5C5B6B7A2FE7C ON patient_sessions');
$this->addSql('ALTER TABLE patient_sessions DROP session_at, DROP inventory_package_id');
}
}