The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
config {
    engine CGI;
    template_engine TT;
    Init Std {  }
    SQL SQLite {  }
    SQL Postgres {  }
    SQL MySQL {  }
    CGI Gantry { gen_root 1; with_server 1; flex_db 1; }
    Control Gantry { dbix 1; }
    Model GantryDBIxClass {  }
    SiteLook GantryDefault {  }
}
app Billing {
    config {
        dbconn `dbi:SQLite:dbname=app.db` => no_accessor;
        template_wrapper `genwrapper.tt` => no_accessor;
    }
    controller is base_controller {
        method do_main is base_links {
        }
        method site_links is links {
        }
    }
    table company {
        field id {
            is int4, primary_key, auto;
        }
        field name {
            is varchar;
            label Name;
            html_form_type text;
        }
        field description {
            is varchar;
            label Description;
            html_form_type text;
        }
        field created {
            is datetime;
        }
        field modified {
            is datetime;
        }
        foreign_display `%name`;
        field street {
            is varchar;
            label Street;
            html_form_type text;
        }
        field city {
            is varchar;
            label City;
            html_form_type text;
        }
        field state {
            is varchar;
            label State;
            html_form_type text;
        }
        field zip {
            is varchar;
            label Zip;
            html_form_type text;
        }
        field phone {
            is varchar;
            label Phone;
            html_form_type text;
        }
        field cell {
            is varchar;
            label Cell;
            html_form_type text;
        }
        field email {
            is varchar;
            label Email;
            html_form_type text;
        }
    }
    controller Company is AutoCRUD {
        controls_table company;
        rel_location company;
        text_description company;
        page_link_label Company;
        method do_main is main_listing {
            cols name, description;
            header_options Add;
            row_options Edit, Delete;
            title Company;
        }
        method form is AutoCRUD_form {
            all_fields_but id, created, modified;
            extra_keys
                legend => `$self->path_info =~ /edit/i ? 'Edit' : 'Add'`;
        }
    }
    table customer {
        field id {
            is int4, primary_key, auto;
        }
        field name {
            is varchar;
            label Name;
            html_form_type text;
        }
        field description {
            is varchar;
            label Description;
            html_form_type text;
        }
        field created {
            is datetime;
        }
        field modified {
            is datetime;
        }
        foreign_display `%name`;
        field street {
            is varchar;
            label Street;
            html_form_type text;
        }
        field city {
            is varchar;
            label City;
            html_form_type text;
        }
        field state {
            is varchar;
            label State;
            html_form_type text;
        }
        field zip {
            is varchar;
            label Zip;
            html_form_type text;
        }
        field phone {
            is varchar;
            label Phone;
            html_form_type text;
        }
        field cell {
            is varchar;
            label Cell;
            html_form_type text;
        }
        field email {
            is varchar;
            label Email;
            html_form_type text;
        }
    }
    controller Customer is AutoCRUD {
        controls_table customer;
        rel_location customer;
        text_description customer;
        page_link_label Customer;
        method do_main is main_listing {
            cols name, description;
            header_options Add;
            row_options Edit, Delete;
            title Customer;
        }
        method form is AutoCRUD_form {
            all_fields_but id, created, modified;
            extra_keys
                legend => `$self->path_info =~ /edit/i ? 'Edit' : 'Add'`;
        }
    }
    table invoice {
        field id {
            is int4, primary_key, auto;
        }
        field number {
            is varchar;
            label Number;
            html_form_type text;
        }
        field description {
            is varchar;
            label Description;
            html_form_type text;
        }
        field created {
            is datetime;
        }
        field modified {
            is datetime;
        }
        foreign_display `%number`;
        field company {
            is int4;
            label Company;
            refers_to company;
            html_form_type select;
        }
        field customer {
            is int4;
            label Customer;
            refers_to customer;
            html_form_type select;
        }
        field status {
            is int4;
            label Status;
            html_form_type select;
            html_form_options
                `Working on it` => 1,
                Billed => 2,
                Paid => 3;
        }
        field sent {
            is date;
            label Sent;
            html_form_type text;
            html_form_optional 1;
            date_select_text `Select Date`;
        }
        field paid {
            is date;
            label Paid;
            html_form_type text;
            html_form_optional 1;
            date_select_text `Select Date`;
        }
        field notes {
            is varchar;
            label Notes;
            html_form_type text;
            html_form_optional 1;
        }
    }
    controller Invoice is AutoCRUD {
        controls_table invoice;
        rel_location invoice;
        text_description invoice;
        page_link_label Invoice;
        method do_main is main_listing {
            cols number, description;
            header_options Add;
            row_options Edit, Delete, Tasks => `"/task/main/$id"`;
            title Invoice;
        }
        method form is AutoCRUD_form {
            all_fields_but id, created, modified;
            extra_keys
                legend => `$self->path_info =~ /edit/i ? 'Edit' : 'Add'`,
                javascript => `$self->calendar_month_js( 'invoice' )`;
            form_name invoice;
        }
        uses Gantry::Plugins::Calendar;
    }
    table task {
        field id {
            is int4, primary_key, auto;
        }
        field name {
            is varchar;
            label Name;
            html_form_type text;
        }
        field description {
            is varchar;
            label Description;
            html_form_type text;
        }
        field created {
            is datetime;
        }
        field modified {
            is datetime;
        }
        foreign_display `%name`;
        field invoice {
            is int4;
            label Invoice;
            refers_to invoice;
            html_form_type select;
        }
        field due_date {
            is date;
            label `Due Date`;
            html_form_type text;
            date_select_text `Select Date`;
        }
        field hours {
            is int4;
            label Hours;
            html_form_type text;
        }
        field charge_per_hour {
            is int4;
            label `Charge Per Hour`;
            html_form_type text;
        }
        field notes {
            is varchar;
            label Notes;
            html_form_type text;
            html_form_optional 1;
        }
    }
    controller Task is AutoCRUD {
        controls_table task;
        rel_location task;
        text_description task;
        page_link_label Task;
        method do_main is main_listing {
            cols name, description;
            header_options Add;
            row_options Edit, Delete;
            title Task;
            limit_by invoice;
        }
        method form is AutoCRUD_form {
            all_fields_but id, created, modified;
            extra_keys
                legend => `$self->path_info =~ /edit/i ? 'Edit' : 'Add'`,
                javascript => `$self->calendar_month_js( 'task' )`;
            form_name task;
        }
        uses Gantry::Plugins::Calendar;
    }
}