VektarDesign
VektarDesign

Essentially, I have a status field which is a dropdown menu with the keys of 1, 2, 3 and so on. When a certain number which will have a value of 'Open' is selected and then is saved, the only columns I then want to display in the backend are ones with a key of 1 -> 'Open'.

Any help at all would be greatly appreciated.

Right now, I have three models:

Customers, Jobs, OpenJobs

Jobs and Open jobs are pretty much the same but I'd like to use my OpenJobs model to then filter jobs that are still open. These two connect to the same database and thus contain the same information.

OpenJobs Model:

fields:
customers:
    label: Customer
    nameFrom: full_name
    descriptionFrom: description
    span: auto
    type: relation
user:
    label: 'Job Allocated to'
    nameFrom: full_name
    descriptionFrom: description
    span: auto
    type: relation
    placeholder: '-- Select User --'
status:
    label: 'Job Status'
    options:
        '1': Open
        '2': Cancelled
        '3': Closed
    emptyOption: Open
    showSearch: true
    span: auto
    placeholder: '-- Select Job Status --'
    required: 1
    type: dropdown
description:
    label: 'Brief Description'
    span: left
    required: 1
    type: text
work:
    label: 'Work done'
    span: full
    size: large
    type: richeditor
paid_status:
    label: 'Payment Status'
    options:
        Unpaid: Unpaid
        Paid: Paid
    showSearch: true
    span: auto
    placeholder: '-- Select Paid Status --'
    required: 1
    type: dropdown
due_date:
    label: 'Due Date'
    mode: date
    span: left
    placeholder: 'Select Date'
    type: datepicker
amount:
    label: 'Total Amount'
    span: left
    placeholder: 'Example - £200.00'
    type: number

OpenJobs columns:

columns:
description:
    label: Description
    type: text
    searchable: true
status:
    label: 'Current Status'
    type: text
    sortable: true
updated_at:
    label: 'Date Updated'
    type: text
    sortable: true
amount:
    label: Amount
    type: number
id:
    label: 'Job Number'
    type: text
    searchable: true
    sortable: true

OpenJobs.php:

<?php namespace Vektar\Crm\Models;

use Model;

/**
* Model
*/
class OpenJobs extends Model
{
use \October\Rain\Database\Traits\Validation;

/*
 * Disable timestamps by default.
 * Remove this line if timestamps are defined in the database table.
 */
public $timestamps = false;

/**
 * @var string The database table used by the model.
 */
public $table = 'vektar_crm_jobs';

/**
 * @var array Validation rules
 */
public $rules = [
];

public $belongsTo = [
    'customers' => [
        'Vektar\Crm\Models\Customers'
    ]
];
}

Last updated

1-1 of 1