Compare commits

...

20 Commits
2.0.0 ... 2.0.1

Author SHA1 Message Date
f4a4c05b61 Merge branch 'build-201' into 'master'
Build 201

See merge request mohit.panjvani/crater-web!120
2019-12-04 12:47:51 +00:00
24637bff4a add estimate & invoice item qty cast, build 201 2019-12-04 17:08:36 +05:30
887ad9a73d build version 201 2019-12-04 16:51:22 +05:30
339099bd34 remove qty from inoice & estimate migration change 2019-12-04 16:43:21 +05:30
9b9761aa5a refactor invoice & estimate migrations 2019-12-04 16:38:25 +05:30
00c917853c Merge branch 'build-201' into 'master'
Build 201

See merge request mohit.panjvani/crater-web!113
2019-12-04 08:15:42 +00:00
122c4f478f build version-201 2019-12-04 13:39:58 +05:30
edc0e115e4 fix database connection issue 2019-12-04 13:38:51 +05:30
b388e7a237 Merge branch 'master' of https://gitlab.com/mohit.panjvani/crater-web into build-201 2019-12-04 13:18:22 +05:30
6e3ed9b4f6 Merge branch 'connection-issue' into 'master'
get error message for connection failed

See merge request mohit.panjvani/crater-web!112
2019-12-04 07:45:53 +00:00
338dbb26a1 refactor database connection failed error message 2019-12-04 13:02:38 +05:30
f10e5e9d11 build 201 2019-12-04 12:39:57 +05:30
3a046b638c decrease update app timeout 2019-12-04 12:34:41 +05:30
36242c516a fix listener issue 2019-12-04 12:32:26 +05:30
c8843eb544 get error message for connection failed 2019-12-04 12:22:23 +05:30
37f2b6dfc7 Merge branch 'build-201' into 'master'
add listener for version 201

See merge request mohit.panjvani/crater-web!107
2019-12-04 06:03:19 +00:00
c90c14312a add listener for version 201 2019-12-04 11:29:39 +05:30
b5b861bb36 Merge branch 'build-200' into 'master'
replace city & state object with their name

See merge request mohit.panjvani/crater-web!106
2019-12-04 05:36:55 +00:00
ab041743a2 remove state & city name from shipping address 2019-12-04 09:41:59 +05:30
9bcec9bd75 replace city & state object with their name 2019-12-04 09:37:22 +05:30
26 changed files with 145 additions and 54 deletions

View File

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

View File

@ -33,10 +33,14 @@ class EnvironmentController extends Controller
*/ */
public function saveDatabaseEnvironment(DatabaseEnvironmentRequest $request) public function saveDatabaseEnvironment(DatabaseEnvironmentRequest $request)
{ {
Artisan::call('config:clear');
Artisan::call('cache:clear');
$results = $this->EnvironmentManager->saveDatabaseVariables($request); $results = $this->EnvironmentManager->saveDatabaseVariables($request);
if(array_key_exists("success", $results)) { if(array_key_exists("success", $results)) {
Artisan::call('config:clear'); Artisan::call('config:clear');
Artisan::call('cache:clear');
Artisan::call('storage:link'); Artisan::call('storage:link');
Artisan::call('key:generate --force'); Artisan::call('key:generate --force');
Artisan::call('migrate --seed --force'); Artisan::call('migrate --seed --force');

View File

@ -82,7 +82,7 @@ class Invoice extends Model
// So the substr returns this 000001 // So the substr returns this 000001
// Add the string in front and higher up the number. // 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. // so it adds the missing zero's when needed.
return sprintf('%06d', intval($number) + 1); return sprintf('%06d', intval($number) + 1);

View File

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

View File

@ -15,7 +15,7 @@ class Listener
protected function isListenerFired($event) protected function isListenerFired($event)
{ {
// Do not apply to the same or newer versions // Do not apply to the same or newer versions
if (version_compare(static::VERSION, $event->old, '<')) { if (version_compare(static::VERSION, $event->old, '<=')) {
return true; return true;
} }

View File

@ -0,0 +1,87 @@
<?php
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;
class Version201 extends Listener
{
const VERSION = '2.0.1';
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle(UpdateFinished $event)
{
if ($this->isListenerFired($event)) {
return;
}
// Remove the language files
$this->removeLanguageFiles();
// Change estimate & invoice migrations
$this->changeMigrations();
// Update Crater app version
Setting::setSetting('version', static::VERSION);
}
private function removeLanguageFiles() {
$en = resource_path('assets/js/plugins/en.js');
$es = resource_path('assets/js/plugins/es.js');
$fr = resource_path('assets/js/plugins/fr.js');
if(file_exists($en)) {
unlink($en);
}
if(file_exists($es)) {
unlink($es);
}
if(file_exists($fr)) {
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

@ -7,6 +7,7 @@ use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Crater\Events\UpdateFinished; use Crater\Events\UpdateFinished;
use Crater\Listeners\Updates\v1\Version110; use Crater\Listeners\Updates\v1\Version110;
use Crater\Listeners\Updates\v2\Version200; use Crater\Listeners\Updates\v2\Version200;
use Crater\Listeners\Updates\v2\Version201;
class EventServiceProvider extends ServiceProvider class EventServiceProvider extends ServiceProvider
{ {
@ -19,6 +20,7 @@ class EventServiceProvider extends ServiceProvider
UpdateFinished::class=> [ UpdateFinished::class=> [
Version110::class, Version110::class,
Version200::class, Version200::class,
Version201::class,
], ],
Registered::class => [ Registered::class => [
SendEmailVerificationNotification::class, SendEmailVerificationNotification::class,

View File

@ -48,17 +48,21 @@ class EnvironmentManager
'DB_USERNAME='.$request->database_username."\n". 'DB_USERNAME='.$request->database_username."\n".
'DB_PASSWORD='.$request->database_password."\n\n"; 'DB_PASSWORD='.$request->database_password."\n\n";
if (! $this->checkDatabaseConnection($request)) { try {
$this->checkDatabaseConnection($request);
return [
'error' => 'connection_failed'
];
} else {
if(\Schema::hasTable('users') ) { if(\Schema::hasTable('users') ) {
return [ return [
'error' => 'database_should_be_empty' 'error' => 'database_should_be_empty'
]; ];
} }
} catch (Exception $e) {
return [
'error' => $e->getMessage()
];
} }
try { try {
@ -118,8 +122,6 @@ class EnvironmentManager
); );
} }
} catch (Exception $e) { } catch (Exception $e) {
return [ return [
'error' => 'mail_variables_save_error' 'error' => 'mail_variables_save_error'
@ -316,12 +318,6 @@ class EnvironmentManager
], ],
]); ]);
try { return DB::connection()->getPdo();
DB::connection()->getPdo();
return true;
} catch (Exception $e) {
return false;
}
} }
} }

View File

@ -9,6 +9,6 @@ return [
| |
*/ */
'version' => '2.0.0', 'version' => '2.0.1',
]; ];

View File

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

View File

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

View File

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

View File

@ -18,9 +18,9 @@ class CreateEstimateItemsTable extends Migration
$table->string('name'); $table->string('name');
$table->string('description')->nullable(); $table->string('description')->nullable();
$table->string('discount_type'); $table->string('discount_type');
$table->unsignedBigInteger('quantity'); $table->decimal('quantity', 15, 2);
$table->unsignedBigInteger('discount'); $table->decimal('discount', 15, 2)->nullable();
$table->unsignedBigInteger('discount_val'); $table->unsignedBigInteger('discount_val')->nullable();
$table->unsignedBigInteger('price'); $table->unsignedBigInteger('price');
$table->unsignedBigInteger('tax'); $table->unsignedBigInteger('tax');
$table->unsignedBigInteger('total'); $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=b43f30be09501b5efa70", "/assets/js/app.js": "/assets/js/app.js?id=2a5cfd8271e10bd501dc",
"/assets/css/crater.css": "/assets/css/crater.css?id=108e3a8d009e7d38018c" "/assets/css/crater.css": "/assets/css/crater.css?id=108e3a8d009e7d38018c"
} }

View File

@ -46,7 +46,7 @@
{{ selectedCustomer.billing_address.address_street_2 }} {{ selectedCustomer.billing_address.address_street_2 }}
</label> </label>
<label v-if="selectedCustomer.billing_address.city && selectedCustomer.billing_address.state"> <label v-if="selectedCustomer.billing_address.city && selectedCustomer.billing_address.state">
{{ selectedCustomer.billing_address.city.name }}, {{ selectedCustomer.billing_address.state.name }} {{ selectedCustomer.billing_address.zip }} {{ selectedCustomer.billing_address.city }}, {{ selectedCustomer.billing_address.state }} {{ selectedCustomer.billing_address.zip }}
</label> </label>
<label v-if="selectedCustomer.billing_address.country"> <label v-if="selectedCustomer.billing_address.country">
{{ selectedCustomer.billing_address.country.name }} {{ selectedCustomer.billing_address.country.name }}
@ -71,7 +71,7 @@
{{ selectedCustomer.shipping_address.address_street_2 }} {{ selectedCustomer.shipping_address.address_street_2 }}
</label> </label>
<label v-if="selectedCustomer.shipping_address.city && selectedCustomer.shipping_address"> <label v-if="selectedCustomer.shipping_address.city && selectedCustomer.shipping_address">
{{ selectedCustomer.shipping_address.city.name }}, {{ selectedCustomer.shipping_address.state.name }} {{ selectedCustomer.shipping_address.zip }} {{ selectedCustomer.shipping_address.city }}, {{ selectedCustomer.shipping_address.state }} {{ selectedCustomer.shipping_address.zip }}
</label> </label>
<label v-if="selectedCustomer.shipping_address.country" class="country"> <label v-if="selectedCustomer.shipping_address.country" class="country">
{{ selectedCustomer.shipping_address.country.name }} {{ selectedCustomer.shipping_address.country.name }}

View File

@ -44,7 +44,7 @@
{{ selectedCustomer.billing_address.address_street_2 }} {{ selectedCustomer.billing_address.address_street_2 }}
</label> </label>
<label v-if="selectedCustomer.billing_address.city && selectedCustomer.billing_address.state"> <label v-if="selectedCustomer.billing_address.city && selectedCustomer.billing_address.state">
{{ selectedCustomer.billing_address.city.name }}, {{ selectedCustomer.billing_address.state.name }} {{ selectedCustomer.billing_address.zip }} {{ selectedCustomer.billing_address.city }}, {{ selectedCustomer.billing_address.state }} {{ selectedCustomer.billing_address.zip }}
</label> </label>
<label v-if="selectedCustomer.billing_address.country"> <label v-if="selectedCustomer.billing_address.country">
{{ selectedCustomer.billing_address.country.name }} {{ selectedCustomer.billing_address.country.name }}
@ -69,7 +69,7 @@
{{ selectedCustomer.shipping_address.address_street_2 }} {{ selectedCustomer.shipping_address.address_street_2 }}
</label> </label>
<label v-if="selectedCustomer.shipping_address.city && selectedCustomer.shipping_address"> <label v-if="selectedCustomer.shipping_address.city && selectedCustomer.shipping_address">
{{ selectedCustomer.shipping_address.city.name }}, {{ selectedCustomer.shipping_address.state.name }} {{ selectedCustomer.shipping_address.zip }} {{ selectedCustomer.shipping_address.city }}, {{ selectedCustomer.shipping_address.state }} {{ selectedCustomer.shipping_address.zip }}
</label> </label>
<label v-if="selectedCustomer.shipping_address.country" class="country"> <label v-if="selectedCustomer.shipping_address.country" class="country">
{{ selectedCustomer.shipping_address.country.name }} {{ selectedCustomer.shipping_address.country.name }}

View File

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

View File

@ -86,7 +86,7 @@ export default {
setTimeout(() => { setTimeout(() => {
location.reload() location.reload()
}, 2000) }, 2000)
}, 5000) }, 1000)
} else { } else {
console.log(res.data) console.log(res.data)
window.toastr['error'](res.data.error) window.toastr['error'](res.data.error)

View File

@ -206,10 +206,10 @@ export default {
} else { } else {
window.toastr['error'](this.$t('wizard.errors.' + response.data.error)) window.toastr['error'](this.$t('wizard.errors.' + response.data.error))
} }
this.loading = false
} catch (e) { } catch (e) {
console.log(e.response)
window.toastr['error'](e.response.data.message) window.toastr['error'](e.response.data.message)
} finally {
this.loading = false
} }
} }
} }

View File

@ -16,12 +16,12 @@
{{$estimate->user->billingaddress->address_street_2}}<br> {{$estimate->user->billingaddress->address_street_2}}<br>
@endif @endif
@if($estimate->user->billingaddress->city && $estimate->user->billingaddress->city->name) @if($estimate->user->billingaddress->city && $estimate->user->billingaddress->city)
{{$estimate->user->billingaddress->city->name}}, {{$estimate->user->billingaddress->city}},
@endif @endif
@if($estimate->user->billingaddress->state && $estimate->user->billingaddress->state->name) @if($estimate->user->billingaddress->state && $estimate->user->billingaddress->state)
{{$estimate->user->billingaddress->state->name}}. {{$estimate->user->billingaddress->state}}.
@endif @endif
@if($estimate->user->billingaddress->zip) @if($estimate->user->billingaddress->zip)

View File

@ -12,10 +12,10 @@
{{$company_address->addresses[0]['address_street_2']}} <br> {{$company_address->addresses[0]['address_street_2']}} <br>
@endif @endif
@if($company_address->addresses[0]['city']) @if($company_address->addresses[0]['city'])
{{$company_address->addresses[0]['city']->name}} {{$company_address->addresses[0]['city']}}
@endif @endif
@if($company_address->addresses[0]['state']) @if($company_address->addresses[0]['state'])
{{$company_address->addresses[0]['state']->name}} {{$company_address->addresses[0]['state']}}
@endif @endif
@if($company_address->addresses[0]['zip']) @if($company_address->addresses[0]['zip'])
{{$company_address->addresses[0]['zip']}} <br> {{$company_address->addresses[0]['zip']}} <br>

View File

@ -16,12 +16,12 @@
{{$estimate->user->shippingaddress->address_street_2}}<br> {{$estimate->user->shippingaddress->address_street_2}}<br>
@endif @endif
@if($estimate->user->shippingaddress->city && $estimate->user->shippingaddress->city->name) @if($estimate->user->shippingaddress->city && $estimate->user->shippingaddress->city)
{{$estimate->user->shippingaddress->city->name}}, {{$estimate->user->shippingaddress->city}},
@endif @endif
@if($estimate->user->shippingaddress->state && $estimate->user->shippingaddress->state->name) @if($estimate->user->shippingaddress->state && $estimate->user->shippingaddress->state)
{{$estimate->user->shippingaddress->state->name}}. {{$estimate->user->shippingaddress->state}}.
@endif @endif
@if($estimate->user->shippingaddress->zip) @if($estimate->user->shippingaddress->zip)

View File

@ -14,11 +14,11 @@
@if($invoice->user->billingaddress->address_street_2) @if($invoice->user->billingaddress->address_street_2)
{{$invoice->user->billingaddress->address_street_2}}<br> {{$invoice->user->billingaddress->address_street_2}}<br>
@endif @endif
@if($invoice->user->billingaddress->city && $invoice->user->billingaddress->city->name) @if($invoice->user->billingaddress->city && $invoice->user->billingaddress->city)
{{$invoice->user->billingaddress->city->name}}, {{$invoice->user->billingaddress->city}},
@endif @endif
@if($invoice->user->billingaddress->state && $invoice->user->billingaddress->state->name) @if($invoice->user->billingaddress->state && $invoice->user->billingaddress->state)
{{$invoice->user->billingaddress->state->name}}. {{$invoice->user->billingaddress->state}}.
@endif @endif
@if($invoice->user->billingaddress->zip) @if($invoice->user->billingaddress->zip)
{{$invoice->user->billingaddress->zip}}<br> {{$invoice->user->billingaddress->zip}}<br>

View File

@ -12,10 +12,10 @@
{{$company_address->addresses[0]['address_street_2']}} <br> {{$company_address->addresses[0]['address_street_2']}} <br>
@endif @endif
@if($company_address->addresses[0]['city']) @if($company_address->addresses[0]['city'])
{{$company_address->addresses[0]['city']->name}} {{$company_address->addresses[0]['city']}}
@endif @endif
@if($company_address->addresses[0]['state']) @if($company_address->addresses[0]['state'])
{{$company_address->addresses[0]['state']->name}} {{$company_address->addresses[0]['state']}}
@endif @endif
@if($company_address->addresses[0]['zip']) @if($company_address->addresses[0]['zip'])
{{$company_address->addresses[0]['zip']}} <br> {{$company_address->addresses[0]['zip']}} <br>

View File

@ -16,12 +16,12 @@
{{$invoice->user->shippingaddress->address_street_2}}<br> {{$invoice->user->shippingaddress->address_street_2}}<br>
@endif @endif
@if($invoice->user->shippingaddress->city && $invoice->user->shippingaddress->city->name) @if($invoice->user->shippingaddress->city && $invoice->user->shippingaddress->city)
{{$invoice->user->shippingaddress->city->name}}, {{$invoice->user->shippingaddress->city}},
@endif @endif
@if($invoice->user->shippingaddress->state && $invoice->user->shippingaddress->state->name) @if($invoice->user->shippingaddress->state && $invoice->user->shippingaddress->state)
{{$invoice->user->shippingaddress->state->name}}. {{$invoice->user->shippingaddress->state}}.
@endif @endif
@if($invoice->user->shippingaddress->zip) @if($invoice->user->shippingaddress->zip)