Add File based templates

This commit is contained in:
gohil jayvirsinh
2021-06-19 12:11:21 +00:00
committed by Mohit Panjwani
parent 00961bcae1
commit d1dd704cdf
58 changed files with 277 additions and 382 deletions

View File

@ -3,7 +3,6 @@
namespace Database\Factories;
use Crater\Models\Estimate;
use Crater\Models\EstimateTemplate;
use Crater\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
@ -76,7 +75,7 @@ class EstimateFactory extends Factory
'company_id' => User::where('role', 'super admin')->first()->company_id,
'user_id' => User::factory()->create(['role' => 'customer'])->id,
'status' => Estimate::STATUS_DRAFT,
'estimate_template_id' => EstimateTemplate::find(1) ?? EstimateTemplate::factory(),
'template_name' => 'estimate1',
'sub_total' => $this->faker->randomDigitNotNull,
'total' => $this->faker->randomDigitNotNull,
'discount_type' => $this->faker->randomElement(['percentage', 'fixed']),

View File

@ -1,30 +0,0 @@
<?php
namespace Database\Factories;
use Crater\Models\EstimateTemplate;
use Illuminate\Database\Eloquent\Factories\Factory;
class EstimateTemplateFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = EstimateTemplate::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'path' => $this->faker->word,
'view' => $this->faker->word,
'name' => $this->faker->word,
];
}
}

View File

@ -3,7 +3,6 @@
namespace Database\Factories;
use Crater\Models\Invoice;
use Crater\Models\InvoiceTemplate;
use Crater\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
@ -101,7 +100,7 @@ class InvoiceFactory extends Factory
'invoice_number' => 'INV-'.Invoice::getNextInvoiceNumber('INV'),
'reference_number' => Invoice::getNextInvoiceNumber('INV'),
'user_id' => User::factory()->create(['role' => 'customer'])->id,
'invoice_template_id' => InvoiceTemplate::find(1) ?? InvoiceTemplate::factory(),
'template_name' => 'invoice1',
'status' => Invoice::STATUS_DRAFT,
'tax_per_item' => 'NO',
'discount_per_item' => 'NO',

View File

@ -1,30 +0,0 @@
<?php
namespace Database\Factories;
use Crater\Models\InvoiceTemplate;
use Illuminate\Database\Eloquent\Factories\Factory;
class InvoiceTemplateFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = InvoiceTemplate::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'path' => $this->faker->word,
'view' => $this->faker->word,
'name' => $this->faker->word,
];
}
}