Skip to content

Commit

Permalink
Merge branch 'build-201' into 'master'
Browse files Browse the repository at this point in the history
Build 201

See merge request mohit.panjvani/crater-web!120
  • Loading branch information
mohitpanjwani committed Dec 4, 2019
2 parents 00c9178 + 24637bf commit f4a4c05
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/EstimateItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class EstimateItem extends Model
'price' => 'integer',
'total' => 'integer',
'discount' => 'float',
'quantity' => 'float',
'discount_val' => 'integer',
'tax' => 'integer'
];
Expand Down
2 changes: 1 addition & 1 deletion app/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function getNextInvoiceNumber()
// 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);
Expand Down
1 change: 1 addition & 0 deletions app/InvoiceItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class InvoiceItem extends Model
'price' => 'integer',
'total' => 'integer',
'discount' => 'float',
'quantity' => 'float',
'discount_val' => 'integer',
'tax' => 'integer'
];
Expand Down
26 changes: 26 additions & 0 deletions app/Listeners/Updates/v2/Version201.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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;
Expand Down Expand Up @@ -37,6 +38,9 @@ public function handle(UpdateFinished $event)
// Remove the language files
$this->removeLanguageFiles();

// Change estimate & invoice migrations
$this->changeMigrations();

// Update Crater app version
Setting::setSetting('version', static::VERSION);
}
Expand All @@ -58,4 +62,26 @@ private function removeLanguageFiles() {
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();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function up()
$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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public function up()
$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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function up()
$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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public function up()
$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');
Expand Down
2 changes: 1 addition & 1 deletion public/assets/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion resources/assets/js/views/invoices/View.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit f4a4c05

Please sign in to comment.