Compare commits

..

24 Commits
2.0.0 ... 2.0.2

Author SHA1 Message Date
7bba576dca Merge branch 'build-202' into 'master'
build version-202

See merge request mohit.panjvani/crater-web!130
2019-12-09 07:00:58 +00:00
05454af593 build version-202 2019-12-09 12:03:57 +05:30
74fe481ed5 Merge branch 'fix-view-issue' into 'master'
fix invoice & estimate view issue

See merge request mohit.panjvani/crater-web!129
2019-12-09 05:59:44 +00:00
1cd654b0cc fix invoice & estimate view issue 2019-12-09 11:19:57 +05:30
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
31 changed files with 223 additions and 66 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

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

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

@ -15,7 +15,7 @@ class Listener
protected function isListenerFired($event)
{
// 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;
}

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

@ -0,0 +1,40 @@
<?php
namespace Crater\Listeners\Updates\v2;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Crater\Events\UpdateFinished;
use Crater\Listeners\Updates\Listener;
use Crater\Setting;
class Version202 extends Listener
{
const VERSION = '2.0.2';
/**
* 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;
}
// Update Crater app version
Setting::setSetting('version', static::VERSION);
}
}

View File

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

View File

@ -48,17 +48,21 @@ class EnvironmentManager
'DB_USERNAME='.$request->database_username."\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') ) {
return [
'error' => 'database_should_be_empty'
];
}
} catch (Exception $e) {
return [
'error' => $e->getMessage()
];
}
try {
@ -118,8 +122,6 @@ class EnvironmentManager
);
}
} catch (Exception $e) {
return [
'error' => 'mail_variables_save_error'
@ -316,12 +318,6 @@ class EnvironmentManager
],
]);
try {
DB::connection()->getPdo();
return true;
} catch (Exception $e) {
return false;
}
return DB::connection()->getPdo();
}
}

View File

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

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=b43f30be09501b5efa70",
"/assets/js/app.js": "/assets/js/app.js?id=36ab3529ebffd4f0624b",
"/assets/css/crater.css": "/assets/css/crater.css?id=108e3a8d009e7d38018c"
}

View File

@ -46,7 +46,7 @@
{{ selectedCustomer.billing_address.address_street_2 }}
</label>
<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 v-if="selectedCustomer.billing_address.country">
{{ selectedCustomer.billing_address.country.name }}
@ -71,7 +71,7 @@
{{ selectedCustomer.shipping_address.address_street_2 }}
</label>
<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 v-if="selectedCustomer.shipping_address.country" class="country">
{{ selectedCustomer.shipping_address.country.name }}

View File

@ -151,6 +151,7 @@ export default {
id: null,
count: null,
estimates: [],
estimate: null,
currency: null,
searchData: {
orderBy: null,
@ -165,10 +166,6 @@ export default {
}
},
computed: {
estimate () {
return this.$store.getters['estimate/getEstimate'](this.$route.params.id)
},
getOrderBy () {
if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) {
return true
@ -180,8 +177,14 @@ export default {
return `/estimates/pdf/${this.estimate.unique_hash}`
}
},
watch: {
$route (to, from) {
this.loadEstimate()
}
},
created () {
this.loadEstimates()
this.loadEstimate()
this.onSearched = _.debounce(this.onSearched, 500)
},
methods: {
@ -192,7 +195,8 @@ export default {
'markAsSent',
'sendEmail',
'deleteEstimate',
'selectEstimate'
'selectEstimate',
'fetchViewEstimate'
]),
async loadEstimates () {
let response = await this.fetchEstimates()
@ -200,6 +204,13 @@ export default {
this.estimates = response.data.estimates.data
}
},
async loadEstimate () {
let response = await this.fetchViewEstimate(this.$route.params.id)
if (response.data) {
this.estimate = response.data.estimate
}
},
async onSearched () {
let data = ''
if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) {

View File

@ -44,7 +44,7 @@
{{ selectedCustomer.billing_address.address_street_2 }}
</label>
<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 v-if="selectedCustomer.billing_address.country">
{{ selectedCustomer.billing_address.country.name }}
@ -69,7 +69,7 @@
{{ selectedCustomer.shipping_address.address_street_2 }}
</label>
<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 v-if="selectedCustomer.shipping_address.country" class="country">
{{ selectedCustomer.shipping_address.country.name }}

View File

@ -154,6 +154,7 @@ export default {
id: null,
count: null,
invoices: [],
invoice: null,
currency: null,
searchData: {
orderBy: null,
@ -167,9 +168,7 @@ export default {
}
},
computed: {
invoice () {
return this.$store.getters['invoice/getInvoice'](this.$route.params.id)
},
getOrderBy () {
if (this.searchData.orderBy === 'asc' || this.searchData.orderBy == null) {
return true
@ -180,8 +179,14 @@ export default {
return `/invoices/pdf/${this.invoice.unique_hash}`
}
},
watch: {
$route (to, from) {
this.loadInvoice()
}
},
created () {
this.loadInvoices()
this.loadInvoice()
this.onSearch = _.debounce(this.onSearch, 500)
},
methods: {
@ -192,7 +197,8 @@ export default {
'markAsSent',
'sendEmail',
'deleteInvoice',
'selectInvoice'
'selectInvoice',
'fetchViewInvoice'
]),
async loadInvoices () {
let response = await this.fetchInvoices()
@ -200,6 +206,13 @@ export default {
this.invoices = response.data.invoices.data
}
},
async loadInvoice () {
let response = await this.fetchViewInvoice(this.$route.params.id)
if (response.data) {
this.invoice = response.data.invoice
}
},
async onSearch () {
let data = ''
if (this.searchData.searchText !== '' && this.searchData.searchText !== null && this.searchData.searchText !== undefined) {
@ -286,7 +299,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)
}

View File

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

View File

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

View File

@ -410,7 +410,7 @@
<div class="bill-address-container">
@include('app.pdf.estimate.partials.billing-address')
</div>
@if($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone)
@if($estimate->user->billingaddress && ($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone))
<div class="ship-address-container">
@else
<div class="ship-address-container " style="float:left;padding-left:0px;">

View File

@ -421,7 +421,7 @@
<div class="ship-address-container">
@include('app.pdf.estimate.partials.shipping-address')
</div>
@if($estimate->user->shippingaddress->name || $estimate->user->shippingaddress->address_street_1 || $estimate->user->shippingaddress->address_street_2 || $estimate->user->shippingaddress->country || $estimate->user->shippingaddress->state || $estimate->user->shippingaddress->city || $estimate->user->shippingaddress->zip || $estimate->user->phone)
@if($estimate->user->shippingaddress && ($estimate->user->shippingaddress->name || $estimate->user->shippingaddress->address_street_1 || $estimate->user->shippingaddress->address_street_2 || $estimate->user->shippingaddress->country || $estimate->user->shippingaddress->state || $estimate->user->shippingaddress->city || $estimate->user->shippingaddress->zip || $estimate->user->phone))
<div class="bill-address-container">
@else
<div class="bill-address-container" style="float:right;padding-right:0px;">

View File

@ -426,7 +426,7 @@
<div style="float:left;">
@include('app.pdf.estimate.partials.billing-address')
</div>
@if($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone)
@if($estimate->user->billingaddress && ($estimate->user->billingaddress->name || $estimate->user->billingaddress->address_street_1 || $estimate->user->billingaddress->address_street_2 || $estimate->user->billingaddress->country || $estimate->user->billingaddress->state || $estimate->user->billingaddress->city || $estimate->user->billingaddress->zip || $estimate->user->billingaddress->phone))
<div style="float:right;">
@else
<div style="float:left;">

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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