Compare commits

..

5 Commits

Author SHA1 Message Date
Nadim Salloum 2d15417dfe
updated js & css 2023-12-20 23:13:49 +01:00
Nadim Salloum 26d4bf9647
remove console.logs 2023-12-20 23:08:03 +01:00
Nadim Salloum ad10d61c04
use new zip code API (old one is deprecated) 2023-12-20 22:51:14 +01:00
Nadim Salloum 3f0ab15f56
add default data for databaseseeder 2023-12-20 22:49:10 +01:00
Nadim Salloum 4bded4db0b
update example env to add user and DB FORWARD 2023-12-20 22:48:22 +01:00
5 changed files with 24 additions and 23 deletions

6
.env.example Normal file → Executable file
View File

@ -1,8 +1,11 @@
APP_NAME="Your SwissCar GmbH - AutoManager" APP_NAME="Your SwissCar GmbH - AutoManager"
APP_ENV=local APP_ENV=local
APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://automngr.test APP_URL=http://automngr.test
APP_PORT=80
USER_1_EMAIL=test@salloum.pm
USER_1_PW=abc123
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_LEVEL=debug LOG_LEVEL=debug
@ -13,6 +16,7 @@ DB_PORT=3306
DB_DATABASE=automngr DB_DATABASE=automngr
DB_USERNAME="sail" DB_USERNAME="sail"
DB_PASSWORD="password" DB_PASSWORD="password"
FORWARD_DB_PORT=3306
BROADCAST_DRIVER=log BROADCAST_DRIVER=log
CACHE_DRIVER=file CACHE_DRIVER=file

12
database/seeders/DatabaseSeeder.php Normal file → Executable file
View File

@ -36,20 +36,20 @@ class DatabaseSeeder extends Seeder
User::factory()->create([ User::factory()->create([
'name' => 'Nadim Salloum', 'name' => 'Nadim Salloum',
'email' => env('USER_1_EMAIL'), 'email' => env('USER_1_EMAIL', 'test@test.ch'),
'password' => bcrypt(env('USER_1_PW')), 'password' => bcrypt(env('USER_1_PW', 'abc123')),
]); ]);
User::factory()->create([ User::factory()->create([
'name' => 'Mohamad Salloum', 'name' => 'Mohamad Salloum',
'email' => env('USER_2_EMAIL'), 'email' => env('USER_2_EMAIL', 'test2@test.ch'),
'password' => bcrypt(env('USER_2_PW')), 'password' => bcrypt(env('USER_2_PW', 'abc123')),
]); ]);
User::factory()->create([ User::factory()->create([
'name' => 'Nadim Salloum', 'name' => 'Nadim Salloum',
'email' => env('USER_3_EMAIL'), 'email' => env('USER_3_EMAIL', 'test3@test.ch'),
'password' => bcrypt(env('USER_3_PW')), 'password' => bcrypt(env('USER_3_PW', 'abc123')),
]); ]);
foreach ($this->getBrands() as $brandItem) { foreach ($this->getBrands() as $brandItem) {

0
public/css/app.css vendored Normal file → Executable file
View File

17
public/js/app.js vendored Normal file → Executable file
View File

@ -23001,17 +23001,14 @@ __webpack_require__.r(__webpack_exports__);
var _this = this; var _this = this;
if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') { if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') {
axios.get("https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=plz_verzeichnis_v2&q=&facet=ortbez18&refine.postleitzahl=".concat(newVal)).then(function (response) { axios.get("https://openplzapi.org/ch/Localities?postalCode=".concat(newVal)).then(function (response) {
var records = response.data.records; var data = response.data;
/*if (records.length > 1) {
records = records.filter(rec => rec.geometry);
}*/
if (records.length > 1) { if (data[0]) {
records = records.filter(function (rec) { _this.form.city = data[0].name;
return rec.geometry;
});
}
if (records[0]) {
_this.form.city = records[0].fields.ortbez18;
} }
}); });
} }

View File

@ -91,14 +91,14 @@ export default {
methods: { methods: {
fetchCity(newVal, oldVal) { fetchCity(newVal, oldVal) {
if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') { if (newVal !== oldVal && newVal.length === 4 && this.form.country === 'CH') {
axios.get(`https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=plz_verzeichnis_v2&q=&facet=ortbez18&refine.postleitzahl=${newVal}`) axios.get(`https://openplzapi.org/ch/Localities?postalCode=${newVal}`)
.then((response) => { .then((response) => {
let records = response.data.records; let data = response.data;
if (records.length > 1) { /*if (records.length > 1) {
records = records.filter(rec => rec.geometry); records = records.filter(rec => rec.geometry);
} }*/
if (records[0]) { if (data[0]) {
this.form.city = records[0].fields.ortbez18; this.form.city = data[0].name;
} }
}); });
} }