-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from jefersonralmeida/development
Versão 1.1
- Loading branch information
Showing
19 changed files
with
604 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
api/database/migrations/2020_04_20_222910_add_contact_info_column_to_entities_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddContactInfoColumnToEntitiesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('entities', function (Blueprint $table) { | ||
$table->string('contact_info')->nullable()->after('description'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('entities', function (Blueprint $table) { | ||
// | ||
}); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...abase/migrations/2020_04_20_222952_add_contact_info_and_unit_columns_to_demands_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddContactInfoAndUnitColumnsToDemandsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('demands', function (Blueprint $table) { | ||
$table->string('contact_info')->nullable()->after('text'); | ||
$table->string('unit')->nullable()->after('quantity'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('demands', function (Blueprint $table) { | ||
// | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ | |
</div> | ||
<div class="form-group"> | ||
<v-text-field | ||
ref="address" | ||
ref="street_address" | ||
v-model="entity.street_address" | ||
:counter="300" | ||
:rules="[rules.required, (value) => rules.min(value, 15), (value) => rules.max(value, 300)]" | ||
|
@@ -59,23 +59,18 @@ | |
></v-select> | ||
</div> | ||
<div class="form-group col-md-10 col-sm-9 col-12"> | ||
<v-autocomplete | ||
ref="city" | ||
v-model="entity.city" | ||
:disabled="entity.state == ''" | ||
:items="cities" | ||
item-text="name" | ||
label="Cidade" | ||
autocomplete="null" | ||
placeholder="Digite o nome da cidade para buscar" | ||
:search-input.sync="search" | ||
outlined | ||
:no-data-text="noDataText" | ||
hide-selected | ||
return-object | ||
></v-autocomplete> | ||
<DistrictSelector :stateId="entity.state" :disabled="entity.state == null" :rules="[rules.required]" :onChangeCB="onCityChange"/> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<v-text-field | ||
ref="contact_info" | ||
v-model="entity.contact_info" | ||
label="Contato" | ||
placeholder="Ex: tel: (00) 0000-0000, email: [email protected]" | ||
outlined | ||
></v-text-field> | ||
</div> | ||
<div class="form-group"> | ||
<v-textarea | ||
ref="description" | ||
|
@@ -99,6 +94,7 @@ | |
<script> | ||
import api from "../../api"; | ||
import rules from "../../util/rules"; | ||
import DistrictSelector from "../widgets/DistrictSelector"; | ||
export default { | ||
props: { | ||
|
@@ -113,8 +109,8 @@ export default { | |
default: () => {} | ||
}, | ||
loading: { | ||
type: Boolean, | ||
default: false | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
data() { | ||
|
@@ -126,14 +122,11 @@ export default { | |
description: "", | ||
street_address: "", | ||
city: "", | ||
state: "" | ||
contact_info: "", | ||
state: 0 | ||
}, | ||
statesFetched: false, | ||
states: [], | ||
cities: [], | ||
search: null, | ||
debounce: null, | ||
noDataText: "Continue digitando para encontrar uma cidade." | ||
}; | ||
}, | ||
computed: { | ||
|
@@ -143,6 +136,7 @@ export default { | |
entity_type_id: 0, | ||
cnpj: entity.cnpj, | ||
name: entity.name, | ||
contact_info: entity.contact_info, | ||
legal_name: entity.legal_name, | ||
description: entity.description, | ||
street_address: entity.street_address, | ||
|
@@ -169,38 +163,23 @@ export default { | |
this.statesFetched = true; | ||
}); | ||
}, | ||
fetchCities(stateId, query) { | ||
return api.getDistricts(stateId, query); | ||
}, | ||
handleSubmit() { | ||
if (!this.isValidForm()) return; | ||
this.onSubmit(this.entityPayload); | ||
}, | ||
isValidForm() { | ||
return this.$refs.form.validate(); | ||
} | ||
}, | ||
watch: { | ||
search(query) { | ||
if (query === null) return; | ||
if (query.length < 3) { | ||
this.noDataText = "Continue digitando para encontrar uma cidade."; | ||
return; | ||
} | ||
clearTimeout(this.debounce); | ||
let that = this; | ||
this.debounce = setTimeout(function() { | ||
that.fetchCities(that.entity.state, query).then(res => { | ||
that.cities = res.data; | ||
that.noDataText = | ||
"Nenhuma cidade encontrada. Verifique a busca ou seja mais específico"; | ||
}); | ||
}, 300); | ||
}, | ||
onCityChange(city){ | ||
this.entity.city = city; | ||
} | ||
}, | ||
created() { | ||
this.fetchStates(); | ||
}, | ||
components: { | ||
DistrictSelector | ||
} | ||
}; | ||
</script> | ||
|
Oops, something went wrong.