mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 07:17:55 +01:00
fix: Fix regole ESLint records
This commit is contained in:
parent
2d43ac1235
commit
8f4d5c38b9
1
.idea/php.xml
generated
1
.idea/php.xml
generated
@ -110,7 +110,6 @@
|
||||
<path value="$PROJECT_DIR$/vendor/devcode-it/openstamanager-standard-modules" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/serializable-closure" />
|
||||
<path value="$PROJECT_DIR$/vendor/openstamanager/standard_modules" />
|
||||
<path value="$PROJECT_DIR$/vendor/maicol07/laravel-json-api-resource" />
|
||||
<path value="$PROJECT_DIR$/vendor/maximebf/debugbar" />
|
||||
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-debugbar" />
|
||||
|
@ -97,29 +97,33 @@ export class RecordsPage extends Page {
|
||||
|
||||
recordDialogMaxWidth: string | number = '75%';
|
||||
|
||||
model: Model;
|
||||
model: typeof Model;
|
||||
|
||||
/** @private */
|
||||
data: Model[] = {};
|
||||
|
||||
async oninit(vnode) {
|
||||
// noinspection JSUnresolvedFunction
|
||||
vnode.state.data = (await this.model.all()).getData();
|
||||
if (vnode.state.data) {
|
||||
for (const record of vnode.state.data) {
|
||||
const response = await this.model.all();
|
||||
this.data = response.getData();
|
||||
|
||||
if (this.data.length > 0) {
|
||||
for (const record of this.data) {
|
||||
this.rows.put(record.id, record);
|
||||
}
|
||||
m.redraw();
|
||||
}
|
||||
}
|
||||
|
||||
async onupdate(vnode) {
|
||||
onupdate(vnode) {
|
||||
const rows: Cash = $('.mdc-data-table__row[data-model-id]');
|
||||
if (rows.length > 0) {
|
||||
rows.on(
|
||||
'click',
|
||||
(event: PointerEvent) => {
|
||||
async (event: PointerEvent) => {
|
||||
if (event.target.tagName === 'MWC-CHECKBOX') {
|
||||
return;
|
||||
}
|
||||
this.updateRecord($(event.target)
|
||||
await this.updateRecord($(event.target)
|
||||
.parent('tr')
|
||||
.data('model-id'));
|
||||
}
|
||||
@ -168,8 +172,8 @@ export class RecordsPage extends Page {
|
||||
}
|
||||
|
||||
async updateRecord(id: number) {
|
||||
// noinspection JSUnresolvedFunction
|
||||
const instance: Model = (await this.model.find(id)).getData();
|
||||
const response = await this.model.find(id);
|
||||
const instance = response.getData();
|
||||
const dialog = $('mwc-dialog#add-record-dialog');
|
||||
|
||||
// eslint-disable-next-line sonarjs/no-duplicate-string
|
||||
@ -190,6 +194,7 @@ export class RecordsPage extends Page {
|
||||
|
||||
await instance.delete();
|
||||
|
||||
// noinspection JSUnresolvedVariable
|
||||
this.rows.forget(instance.id);
|
||||
m.redraw();
|
||||
await showSnackbar(__('Record eliminato!'), 4000);
|
||||
@ -210,7 +215,7 @@ export class RecordsPage extends Page {
|
||||
<mwc-dialog id="add-record-dialog" class="record-dialog"
|
||||
heading={__('Aggiungi nuovo record')}
|
||||
style={`--mdc-dialog-max-width: ${this.recordDialogMaxWidth}`}>
|
||||
<form method="PUT">
|
||||
<form>
|
||||
<text-field id="id" name="id" style="display: none;" data-default-value=""/>
|
||||
{(() => {
|
||||
const sections = collect(this.sections);
|
||||
|
1
resources/js/Models/Model.js
vendored
1
resources/js/Models/Model.js
vendored
@ -20,6 +20,7 @@ export default class Model extends BaseModel {
|
||||
super();
|
||||
|
||||
// Return a proxy of this object to allow dynamic attributes getters and setters
|
||||
// eslint-disable-next-line no-constructor-return
|
||||
return new Proxy(this, {
|
||||
get(target: this, property, receiver) {
|
||||
const accessor = target[`get${capitalize(property)}Attribute`];
|
||||
|
Loading…
x
Reference in New Issue
Block a user