Inital commit
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<li><a href="{url path='/admin/configuration/countries'}">{intl l="Countries"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='countries_top'}
|
||||
{hook name="countries.top" location="countries_top" }
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -28,12 +28,26 @@
|
||||
<form action="" method="post">
|
||||
|
||||
<div class="general-block-decorator">
|
||||
|
||||
{ifloop rel="country-not-in-any-zone"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning">
|
||||
{intl l='<strong>Warning</strong>, some of your countries are not included in any shipping zone:'}
|
||||
{loop name="country-not-in-any-zone" type="country" with_area=false}
|
||||
{$TITLE}{if $LOOP_COUNT < $LOOP_TOTAL},{else}.{/if}
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/ifloop}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption class="clearfix">
|
||||
<caption class="clearfix">
|
||||
{intl l='Countries'}
|
||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.configuration.country" access="CREATE"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new country'}" href="#add_country_dialog" data-toggle="modal">
|
||||
<a class="btn btn-primary action-btn" title="{intl l='Add a new country'}" href="#add_country_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -43,46 +57,67 @@
|
||||
<th>{intl l="ID"}</th>
|
||||
<th>{intl l="Name"}</th>
|
||||
<th>{intl l="Default"}</th>
|
||||
<th>{intl l="Shop"}</th>
|
||||
<th>{intl l="N° ISO"}</th>
|
||||
<th>{intl l="ISO Code"}</th>
|
||||
<th>{intl l="Shipping zone"}</th>
|
||||
<th>{intl l="Visible"}</th>
|
||||
|
||||
{module_include location='countries_table_header'}
|
||||
{hook name="countries.table-header" location="countries_table_header" }
|
||||
|
||||
<th class="actions">{intl l='Actions'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="countries" type="country" backend_context="1" lang=$lang_id order=$order}
|
||||
{loop name="countries" type="country" backend_context="1" lang=$lang_id order=$order visible="*"}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
<td><a href="{url path="/admin/configuration/country/update/{$ID}"}">{$TITLE}</a></td>
|
||||
<td><a href="{url path="/admin/configuration/country/update/%id" id=$ID}">{$TITLE}</a></td>
|
||||
<td>
|
||||
<div class="make-switch switch-small switch-radio change-default-toggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input class="change-default-toggle" type="radio" name="by_default" value="{$ID}" {if $IS_DEFAULT}checked="checked"{/if}/>
|
||||
</div>
|
||||
</td>
|
||||
{* <td>
|
||||
<div class="make-switch switch-small switch-radio" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input class="change-default" type="radio" name="" value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}/>
|
||||
</div>
|
||||
</td> *}
|
||||
<td>{$ISOCODE}</td>
|
||||
<td>{$ISOALPHA3}</td>
|
||||
<td>
|
||||
{loop type="area" name="country-area" country={$ID}}
|
||||
<a href="{url path="/admin/configuration/shipping_configuration/update/%id" id=$ID}">{$NAME}</a>{if $LOOP_COUNT < $LOOP_TOTAL},{/if}
|
||||
{/loop}
|
||||
{elseloop rel="country-area"}
|
||||
<span class="text-warning"><i class="glyphicon glyphicon-warning-sign"></i> {intl l='None'}</span>
|
||||
{/elseloop}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.country" access="UPDATE"}
|
||||
<div class="make-switch switch-small visibleToggle" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="visibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
{/loop}
|
||||
|
||||
{module_include location='countries_table_row'}
|
||||
{elseloop rel="can_change"}
|
||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||
<input type="checkbox" class="disabled" disabled="disabled" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
|
||||
{hook name="countries.table-row" location="countries_table_row" country_id={$ID} }
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
<div class="btn-toolbar btn toolbar-primary">
|
||||
<span class="glyphicon glyphicon-cog"></span>
|
||||
</div>
|
||||
<div class="toolbar-options hidden">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.country" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs country-change" title="{intl l='Change this country'}" href="{url path="/admin/configuration/country/update/{$ID}"}">
|
||||
<a class="country-change" title="{intl l='Change this country'}" href="{url path="/admin/configuration/country/update/%id" id=$ID}">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.configuration.country" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs country-delete" title="{intl l='Delete this country'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<a class="country-delete" title="{intl l='Delete this country'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -110,7 +145,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
{module_include location='countries_bottom'}
|
||||
{hook name="countries.bottom" location="countries_bottom" }
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -122,63 +157,38 @@
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "country_creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{form_hidden_fields exclude="locale"}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/country/update/_ID_'}" />
|
||||
{/form_field}
|
||||
{* 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/country/update/_ID_'}"}
|
||||
|
||||
{loop type="lang" name="current-edit-lang" default_only="1"}
|
||||
{custom_render_form_field field="title"}
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Country title'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></span>
|
||||
</div>
|
||||
<div class="help-block">{intl l="Enter here the value in the default language (%title)" title={$TITLE}}</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{render_form_field field="locale" value=$LOCALE}
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="title"}>
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}" /></span>
|
||||
</div>
|
||||
{/loop}
|
||||
{/custom_render_form_field}
|
||||
|
||||
{form_field form=$form field='area'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
{render_form_field field="isocode"}
|
||||
{render_form_field field="isoalpha2"}
|
||||
{render_form_field field="isoalpha3"}
|
||||
|
||||
{form_field form=$form field='isocode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='ISO Code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{custom_render_form_field field="visible"}
|
||||
<input type="checkbox" checked {form_field_attributes field="visible"}> {$label}
|
||||
{/custom_render_form_field}
|
||||
|
||||
{form_field form=$form field='isoalpha2'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Alpha code 2'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{custom_render_form_field field="has_states"}
|
||||
<input type="checkbox" {form_field_attributes field="has_states"}> {$label}
|
||||
{/custom_render_form_field}
|
||||
|
||||
{form_field form=$form field='isoalpha3'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Alpha code 3'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='country_create_form'}
|
||||
{hook name="country.create-form" location="country_create_form" }
|
||||
|
||||
{/capture}
|
||||
|
||||
@@ -193,7 +203,7 @@
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path='/admin/configuration/countries/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_enctype = {form_enctype}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
@@ -204,7 +214,7 @@
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="country_id" id="country_delete_id" value="" />
|
||||
|
||||
{module_include location='country_delete_form'}
|
||||
{hook name="country.delete-form" location="country_delete_form" }
|
||||
|
||||
{/capture}
|
||||
|
||||
@@ -215,7 +225,7 @@
|
||||
dialog_title = {intl l="Delete country"}
|
||||
dialog_message = {intl l="Do you really want to delete this country ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/countries/delete'}
|
||||
form_action = {token_url path='/admin/configuration/countries/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
@@ -266,6 +276,18 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
{* Visibility toggle *}
|
||||
|
||||
$(".visibleToggle").on('switch-change', function(event, data) {
|
||||
$.ajax({
|
||||
url : "{url path='admin/configuration/country/toggle-online'}",
|
||||
data : {
|
||||
country_id : $(this).data('id'),
|
||||
action : 'visibilityToggle'
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -274,5 +296,5 @@
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='countries-js'}
|
||||
{hook name="countries.js" location="countries-js" }
|
||||
{/block}
|
||||
Reference in New Issue
Block a user