Merge branch 'build-201' into 'master'

Build 201

See merge request mohit.panjvani/crater-web!120
This commit is contained in:
Mohit Panjwani
2019-12-04 12:47:51 +00:00
11 changed files with 39 additions and 11 deletions

View File

@ -24,6 +24,7 @@ class EstimateItem extends Model
'price' => 'integer',
'total' => 'integer',
'discount' => 'float',
'quantity' => 'float',
'discount_val' => 'integer',
'tax' => 'integer'
];

View File

@ -82,7 +82,7 @@ class Invoice extends Model
// So the substr returns this 000001
// Add the string in front and higher up the number.
// the %05d part makes sure that there are always 6 numbers in the string.
// the %06d part makes sure that there are always 6 numbers in the string.
// so it adds the missing zero's when needed.
return sprintf('%06d', intval($number) + 1);

View File

@ -30,6 +30,7 @@ class InvoiceItem extends Model
'price' => 'integer',
'total' => 'integer',
'discount' => 'float',
'quantity' => 'float',
'discount_val' => 'integer',
'tax' => 'integer'
];

View File

@ -4,6 +4,7 @@ namespace Crater\Listeners\Updates\v2;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Database\Schema\Blueprint;
use Crater\Events\UpdateFinished;
use Crater\Listeners\Updates\Listener;
use Crater\Setting;
@ -37,6 +38,9 @@ class Version201 extends Listener
// Remove the language files
$this->removeLanguageFiles();
// Change estimate & invoice migrations
$this->changeMigrations();
// Update Crater app version
Setting::setSetting('version', static::VERSION);
}
@ -58,4 +62,26 @@ class Version201 extends Listener
unlink($fr);
}
}
private function changeMigrations()
{
\Schema::table('invoices', function (Blueprint $table) {
$table->decimal('discount', 15, 2)->nullable()->change();
});
\Schema::table('estimates', function (Blueprint $table) {
$table->decimal('discount', 15, 2)->nullable()->change();
});
\Schema::table('invoice_items', function (Blueprint $table) {
$table->decimal('quantity', 15, 2)->change();
$table->decimal('discount', 15, 2)->nullable()->change();
});
\Schema::table('estimate_items', function (Blueprint $table) {
$table->decimal('quantity', 15, 2)->change();
$table->decimal('discount', 15, 2)->nullable()->change();
$table->unsignedBigInteger('discount_val')->nullable()->change();
});
}
}

View File

@ -25,7 +25,7 @@ class CreateInvoicesTable extends Migration
$table->string('discount_per_item');
$table->text('notes')->nullable();
$table->string('discount_type')->nullable();
$table->unsignedBigInteger('discount')->nullable();
$table->decimal('discount', 15, 2)->nullable();
$table->unsignedBigInteger('discount_val')->nullable();
$table->unsignedBigInteger('sub_total');
$table->unsignedBigInteger('total');

View File

@ -18,10 +18,10 @@ class CreateInvoiceItemsTable extends Migration
$table->string('name');
$table->string('description')->nullable();
$table->string('discount_type');
$table->unsignedBigInteger('quantity');
$table->unsignedBigInteger('price');
$table->decimal('quantity', 15, 2);
$table->decimal('discount', 15, 2)->nullable();
$table->unsignedBigInteger('discount_val');
$table->unsignedBigInteger('discount');
$table->unsignedBigInteger('tax');
$table->unsignedBigInteger('total');
$table->integer('invoice_id')->unsigned();

View File

@ -23,8 +23,8 @@ class CreateEstimatesTable extends Migration
$table->string('tax_per_item');
$table->string('discount_per_item');
$table->string('notes')->nullable();
$table->decimal('discount', 15, 2)->nullable();
$table->string('discount_type')->nullable();
$table->unsignedBigInteger('discount')->nullable();
$table->unsignedBigInteger('discount_val')->nullable();
$table->unsignedBigInteger('sub_total');
$table->unsignedBigInteger('total');

View File

@ -18,9 +18,9 @@ class CreateEstimateItemsTable extends Migration
$table->string('name');
$table->string('description')->nullable();
$table->string('discount_type');
$table->unsignedBigInteger('quantity');
$table->unsignedBigInteger('discount');
$table->unsignedBigInteger('discount_val');
$table->decimal('quantity', 15, 2);
$table->decimal('discount', 15, 2)->nullable();
$table->unsignedBigInteger('discount_val')->nullable();
$table->unsignedBigInteger('price');
$table->unsignedBigInteger('tax');
$table->unsignedBigInteger('total');

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/assets/js/app.js": "/assets/js/app.js?id=334224502420e0ff495c",
"/assets/js/app.js": "/assets/js/app.js?id=2a5cfd8271e10bd501dc",
"/assets/css/crater.css": "/assets/css/crater.css?id=108e3a8d009e7d38018c"
}

View File

@ -286,7 +286,7 @@ export default {
let request = await this.deleteInvoice(this.id)
if (request.data.success) {
window.toastr['success'](this.$tc('invoices.deleted_message', 1))
this.$router.push('/admin/invoices/')
this.$router.push('/admin/invoices')
} else if (request.data.error) {
window.toastr['error'](request.data.message)
}