{extends file="admin-layout.tpl"} {block name="no-return-functions"} {$admin_current_location = 'configuration'} {/block} {block name="page-title"}{intl l='States'}{/block} {block name="check-resource"}admin.configuration.state{/block} {block name="check-access"}view{/block} {block name="main-content"}
{hook name="states.top" location="states_top" }

{intl l='States'} {loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.state" access="CREATE"} {/loop}
{intl l="ID"} | {intl l="Name"} | {intl l="ISO Code"} | {intl l="Country"} | {intl l="Visible"} {hook name="states.table-header" location="states_table_header" } | {intl l='Actions'}
--- | --- | --- | --- | --- | ---
{loop name="state_list" type="state" backend_context="1" page=$page limit=$page_limit order=$order visible="*"}
{$ID} | {$TITLE} | {$ISOCODE} | {loop type="country" name="country" id={$COUNTRY} limit="1" visible="*"} {$TITLE} {/loop} | {loop type="auth" name="can_change" role="ADMIN" resource="admin.state" access="UPDATE"} {/loop} {elseloop rel="can_change"} {/elseloop} {hook name="states.table-row" location="states_table_row" state_id={$ID} } | {loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.state" access="UPDATE"} {/loop} {loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.state" access="DELETE"} {/loop}
{/loop} {elseloop rel="state_list"}
{intl l="No state has been created yet. Click the + button to create one."}
{/elseloop}
{ifloop rel="state_list"}
{include file = "includes/pagination.html" loop_ref = "state_list" max_page_count = 10 page_url = "{url path="/admin/configuration/states"}" }
{/ifloop}

{hook name="states.bottom" location="states_bottom" }
{* Adding a new State *} {form name="thelia.admin.state.creation"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "state_creation_dialog"} {form_hidden_fields exclude="locale"} {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} {render_form_field field='success_url' value="{url path='/admin/configuration/state/update/_ID_'}"} {custom_render_form_field field="title"} {loop type="lang" name="default-lang" default_only="1"} {* Switch edition to the current locale *} {render_form_field field="locale" value=$LOCALE}
{/loop} {/custom_render_form_field} {custom_render_form_field field='country_id'}
{/custom_render_form_field} {render_form_field field="isocode"} {custom_render_form_field field="visible"} {$label} {/custom_render_form_field} {hook name="state.create-form" location="state_create_form" } {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "add_state_dialog" dialog_title = {intl l="Create a new state"} dialog_body = {$smarty.capture.state_creation_dialog nofilter} dialog_ok_label = {intl l="Create this state"} dialog_cancel_label = {intl l="Cancel"} form_action = {url path='/admin/configuration/states/create'} form_enctype = {form_enctype} form_error_message = $form_error_message } {/form} {* Delete confirmation dialog *} {capture "delete_dialog"} {hook name="state.delete-form" location="state_delete_form" } {/capture} {include file = "includes/generic-confirm-dialog.html" dialog_id = "delete_dialog" dialog_title = {intl l="Delete state"} dialog_message = {intl l="Do you really want to delete this state ?"} form_action = {token_url path='/admin/configuration/states/delete'} form_content = {$smarty.capture.delete_dialog nofilter} } {/block} {block name="javascript-initialization"} {javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
{/javascripts} {/block} {block name="javascript-last-call"} {hook name="states.js" location="states-js" } {/block}