Skip to content

Commit

Permalink
feat: manage contact addresses (monicahq/chandler#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Feb 4, 2022
1 parent a8e0cfb commit 8896a66
Show file tree
Hide file tree
Showing 155 changed files with 5,934 additions and 4,692 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ indent_size = 4
[*.blade.php]
indent_size = 2

[*.{js,vue,scss}]
[*.{js,vue,scss,json}]
indent_size = 2

[*.md]
Expand Down
103 changes: 28 additions & 75 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,49 @@
module.exports = {
'env': {
'browser': true,
'es6': true
env: {
browser: true,
es6: true,
},
'extends': [
'plugin:vue/recommended'
],
'parserOptions': {
'ecmaVersion': 12,
'sourceType': 'module'
extends: ['plugin:vue/recommended'],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
'plugins': [
'vue',
],
'rules': {
'array-bracket-spacing': [
'error',
'never'
],
'indent': [
'error',
2
],
'linebreak-style': [
'error',
'unix'
],
plugins: ['vue'],
rules: {
'array-bracket-spacing': ['error', 'never'],
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
'no-trailing-spaces': [
'error',
{
'ignoreComments': true,
'skipBlankLines': true
}
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
ignoreComments: true,
skipBlankLines: true,
},
],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'semi-spacing': [
'error',
{
'after': true,
'before': false
}
],
'semi-style': [
'error',
'last'
after: true,
before: false,
},
],
'semi-style': ['error', 'last'],

// strongly recommended
'vue/component-name-in-template-casing': [
'error',
'kebab-case'
],
'vue/component-tags-order': [
'warn',
{
'order': [['style', 'template'], 'script']
}
],
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/html-end-tags': 'error',
'vue/html-self-closing': [
'error',
{
'html': {
'normal': 'always',
'void': 'never'
}
}
html: {
normal: 'always',
void: 'never',
},
},
],
'vue/no-v-model-argument': 0,
'vue/no-v-html': 0,
'vue/max-attributes-per-line': [
// https://vuejs.org/v2/style-guide/#Multi-attribute-elements-strongly-recommended
'error',
{
'singleline': 5,
'multiline': {
'max': 5,
'allowFirstLine': true
}
}
],
'vue/singleline-html-element-content-newline': ['error', {
'ignoreWhenNoAttributes': true,
'ignoreWhenEmpty': true,
'ignores': ['pre', 'textarea', 'inertia-link', 'a', 'p', 'li']
}]
}
},
};
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public/js
public/css
storage
vendor
node_modules
composer.lock
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 120,
"tabWidth": 2,
"trailingComma": "all",
"singleQuote": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
use App\Services\Account\ManageTemplate\DestroyTemplate;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\Http\Controllers\Vault\ViewHelpers\VaultIndexViewHelper;
use App\Http\Controllers\Settings\Personalize\Modules\ViewHelpers\PersonalizeModuleIndexViewHelper;
use App\Http\Controllers\Settings\Personalize\Templates\ViewHelpers\PersonalizeTemplateShowViewHelper;
use App\Http\Controllers\Settings\Personalize\Templates\ViewHelpers\PersonalizeTemplateIndexViewHelper;

class PersonalizeModulesController extends Controller
{
public function index()
{
return Inertia::render('Settings/Personalize/Templates/Index', [
return Inertia::render('Settings/Personalize/Modules/Index', [
'layoutData' => VaultIndexViewHelper::layoutData(),
'data' => PersonalizeTemplateIndexViewHelper::data(Auth::user()->account),
'data' => PersonalizeModuleIndexViewHelper::data(Auth::user()->account),
]);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Http\Controllers\Settings\Personalize\Modules\ViewHelpers;

use App\Models\Module;
use App\Models\Account;

class PersonalizeModuleIndexViewHelper
{
public static function data(Account $account): array
{
$modules = $account->modules()
->orderBy('name', 'asc')
->get();

$collection = collect();
foreach ($modules as $module) {
$collection->push(self::dtoModule($module));
}

return [
'modules' => $collection,
'url' => [
'settings' => route('settings.index'),
'personalize' => route('settings.personalize.index'),
'module_store' => route('settings.personalize.module.store'),
],
];
}

public static function dtoModule(Module $module): array
{
return [
'id' => $module->id,
'name' => $module->name,
'type' => $module->type,
'reserved_to_contact_information' => $module->reserved_to_contact_information,
'can_be_deleted' => $module->can_be_deleted,
'url' => [
'update' => route('settings.personalize.module.update', [
'module' => $module->id,
]),
'destroy' => route('settings.personalize.module.destroy', [
'module' => $module->id,
]),
],
];
}
}
Binary file removed app/Jobs/.SetupAccount.php.swp
Binary file not shown.
Loading

0 comments on commit 8896a66

Please sign in to comment.