Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8608184d

Von Werner Hahn vor mehr als 7 Jahren hinzugefügt

  • ID 8608184d41fca27d9ecf1aff9cc781c87aeb8103
  • Vorgänger 4369213f
  • Nachfolger 6b55ec18

Shopmodul: Nach Umbennenung Dateien mit Verweis richtig gestellt

Unterschiede anzeigen:

SL/Controller/Part.pm
sub _set_javascript {
my ($self) = @_;
$::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.shop_part);
$::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.ShopPart);
$::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $self->part->id ]})});") if $self->part->id;
}
SL/Controller/ShopPart.pm
use SL::DB::ShopPart;
use SL::DB::File;
use SL::DB::ShopImage;
use SL::Controller::FileUploader;
use SL::DB::Default;
use SL::Helper::Flash;
use MIME::Base64;
......
$self->js
->dialog->close('#jqueryui_popup_dialog')
->run('kivi.shop_part.show_images',$self->file->trans_id)
->run('kivi.ShopPart.show_images',$self->file->trans_id)
->render();
}
......
$self->js
->dialog->close('#jqueryui_popup_dialog')
->run('kivi.shop_part.show_images',$self->file->trans_id)
->run('kivi.ShopPart.show_images',$self->file->trans_id)
->render();
}
......
$self->file->delete;
$self->js
->run('kivi.shop_part.show_images',$self->file->trans_id)
->run('kivi.ShopPart.show_images',$self->file->trans_id)
->render();
}
......
$self->js
->run(
'kivi.shop_part.shop_part_dialog',
'kivi.ShopPart.shop_part_dialog',
t8('Shopcategories'),
$self->render('shop_part/categories', { output => 0 }, CATEGORIES => $categories )
)
......
->html('#shop_part_active_' . $self->shop_part->id, $self->shop_part->active)
->html('#price_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$price,2))
->html('#active_price_source_' . $self->shop_part->id, $price_src_str)
->run('kivi.shop_part.close_dialog')
->run('kivi.ShopPart.close_dialog')
->flash('info', t8("Updated shop part"))
->render;
}
......
# or a new shop_part with only part_id and shop_id set
$self->js
->run(
'kivi.shop_part.shop_part_dialog',
'kivi.ShopPart.shop_part_dialog',
t8('Shop part'),
$self->render('shop_part/edit', { output => 0 }) #, shop_part => $self->shop_part)
)
......
flash('info', t8('The categories has been saved.'));
$self->js->run('kivi.shop_part.close_dialog')
$self->js->run('kivi.ShopPart.close_dialog')
->flash('info', t8("Updated categories"))
->render;
}
......
my $html = $self->render('shop_part/_upload_status', { output => 0 }, job => $job);
$self->js->html('#status_mass_upload', $html);
$self->js->run('kivi.shop_part.massUploadFinished') if $job->data_as_hash->{status} == SL::BackgroundJob::ShopPartMassUpload->DONE();
$self->js->run('kivi.ShopPart.massUploadFinished') if $job->data_as_hash->{status} == SL::BackgroundJob::ShopPartMassUpload->DONE();
$self->js->render;
}
......
$self->js
->html('#status_mass_upload', $html)
->run('kivi.shop_part.massUploadStarted')
->run('kivi.ShopPart.massUploadStarted')
->render;
}
......
# internal stuff
#
sub add_javascripts {
$::request->{layout}->add_javascripts(qw(kivi.shop_part.js));
$::request->{layout}->add_javascripts(qw(kivi.ShopPart.js));
}
sub load_pricesources {
js/kivi.ShopPart.js
namespace('kivi.shop_part', function(ns) {
namespace('kivi.ShopPart', function(ns) {
var $dialog;
// this is called by sub render, with a certain prerendered html (edit.html,categories.html)
......
ns.setup = function() {
kivi.shop_part.massUploadInitialize();
kivi.ShopPart.massUploadInitialize();
kivi.submit_ajax_form('controller.pl?action=ShopPart/mass_upload','[name=shop_parts]');
};
templates/webpages/ic/tabs/_shop.html
[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
[%- USE Dumper %]
[%- USE JavaScript -%]
<div id="shop_variables">
<h2>[% LxERP.t8("Active shops:") %]</h2>
<table width="100%">
<thead>
<tr class="listheading">
<th>[% LxERP.t8("Shop") %]</th>
<th>[% LxERP.t8("Active") %]</th>
<th>[% LxERP.t8("Shop part") %]</th>
<th>[% LxERP.t8("Price source") %]</th>
<th>[% LxERP.t8("Price") %]</th>
<th>[% LxERP.t8("Stock Local/Shop") %]</th>
<th>[% LxERP.t8("Last update") %]</th>
<th>[% LxERP.t8("Action") %]</th>
<th>[% LxERP.t8("Action") %]</th>
<th>[% LxERP.t8("Action") %]</th>
</tr>
</thead>
[%- FOREACH shop_part = SHOP_PARTS %]
<tr class="listrow">
<td>[% HTML.escape( shop_part.shop.description ) %]</td>
<td>[% L.html_tag('span', shop_part.active, id => 'shop_part_active_' _ shop_part.id ) %]</td>
<td>[% L.html_tag('span', shop_part.shop_description, id => 'shop_part_description_' _ shop_part.id ) %]</td>
<td> [% L.html_tag('span',LxERP.t8(), id => 'active_price_source_' _ shop_part.id) %] </td>
<td>[% L.html_tag('span','Price', id => 'price_' _ shop_part.id) %]</td>
<td>[% L.html_tag('span','Stock', id => 'stock_' _ shop_part.id) %]</td>
<td>[% L.html_tag('span', shop_part.last_update.to_kivitendo('precision' => 'minute'), id => 'shop_part_last_update_' _ shop_part.id ) %]</td>
<td>[% L.button_tag("kivi.shop_part.edit_shop_part(" _ shop_part.id _ ")", LxERP.t8("Edit")) %]</td>
<td>[% L.button_tag("kivi.shop_part.update_shop_part(" _ shop_part.id _ ")", LxERP.t8("Upload")) %]</td>
<td>[% L.button_tag("kivi.shop_part.get_all_categories(" _ shop_part.id _ ")", LxERP.t8("Shopcategories")) %]</td>
</tr>
<script type="text/javascript">
$(function() {
kivi.shop_part.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
kivi.shop_part.update_stock([% shop_part.id %]);
});
</script>
[%- END %]
[%- FOREACH shop = SHOPS_NOT_ASSIGNED %]
<tr>
<td>[% HTML.escape( shop.description ) %]</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>[% L.button_tag("kivi.shop_part.create_shop_part(" _ id _ ", " _ shop.id _ ")", LxERP.t8("Add")) %]</td>
<td></td>
</tr>
[%- END %]
</table>
[% # L.dump(shop_part) %]
<h2>[% LxERP.t8("Shopvariables and Images - valid for all shops") %]</h2>
[%- IF CUSTOM_VARIABLES.size %]
[% # L.dump(CUSTOM_VARIABLES) %]
<div id="shop_custom_variables">
<p>
<table>
[%- FOREACH var = CUSTOM_VARIABLES %]
[%- IF var.name.match('^shop_') %]
<tr>
[% # IF !var.partsgroup_filtered %]
<td align="right" valign="top">[% HTML.escape(var.description) %]</td>
[% # END %]
<td align="right" valign="top">[% var.VALID_BOX %]</td>
<td valign="top">[% var.HTML_CODE %]</td>
</tr>
[%- END %]
[%- END %]
</table>
</p>
</div>
[%- END %]
[%- IF shop_part.part_id %]
<script type="text/javascript">
$(function() {
kivi.shop_part.show_images([% shop_part.part_id %]);
});
</script>
<div id="shop_images" border=1 ></div>
[%- ELSE %]
<div id="shop_images" border=1 >[% LxERP.t8('To upload images: Please create shoppart first') %]</div>
[%- END %]
</div>
templates/webpages/part/_shop.html
<td>[% L.html_tag('span','Price', id => 'price_' _ shop_part.id) %]</td>
<td>[% L.html_tag('span','Stock', id => 'stock_' _ shop_part.id) %]</td>
<td>[% L.html_tag('span', shop_part.last_update.to_kivitendo('precision' => 'minute'), id => 'shop_part_last_update_' _ shop_part.id ) %]</td>
<td>[% L.button_tag("kivi.shop_part.edit_shop_part(" _ shop_part.id _ ")", LxERP.t8("Edit")) %]</td>
<td>[% L.button_tag("kivi.shop_part.update_shop_part(" _ shop_part.id _ ")", LxERP.t8("Upload")) %]</td>
<td>[% L.button_tag("kivi.shop_part.get_all_categories(" _ shop_part.id _ ")", LxERP.t8("Shopcategories")) %]<br>[% HTML.escape(shop_part.part.partsgroup.partsgroup) %]</td>
<td>[% L.button_tag("kivi.ShopPart.edit_shop_part(" _ shop_part.id _ ")", LxERP.t8("Edit")) %]</td>
<td>[% L.button_tag("kivi.ShopPart.update_shop_part(" _ shop_part.id _ ")", LxERP.t8("Upload")) %]</td>
<td>[% L.button_tag("kivi.ShopPart.get_all_categories(" _ shop_part.id _ ")", LxERP.t8("Shopcategories")) %]<br>[% HTML.escape(shop_part.part.partsgroup.partsgroup) %]</td>
</tr>
<script type="text/javascript">
$(function() {
kivi.shop_part.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
kivi.shop_part.update_stock([% shop_part.id %]);
kivi.ShopPart.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
kivi.ShopPart.update_stock([% shop_part.id %]);
});
</script>
[% END %]
......
<td></td>
<td></td>
<td></td>
<td>[% L.button_tag("kivi.shop_part.create_shop_part(" _ id _ ", " _ shop.id _ ")", LxERP.t8("Add")) %]</td>
<td>[% L.button_tag("kivi.ShopPart.create_shop_part(" _ id _ ", " _ shop.id _ ")", LxERP.t8("Add")) %]</td>
</tr>
</thead>
[%- END %]
......
[%- IF shop_part.part_id %]
<script type="text/javascript">
$(function() {
kivi.shop_part.show_images([% shop_part.part_id %]);
kivi.ShopPart.show_images([% shop_part.part_id %]);
});
</script>
<div id="shop_images" border=1 ></div>
templates/webpages/shop_part/_list_articles.html
</td>
<td style="vertical-align:middle;text-align:center;">
[% IF shop_part.active %]
<div id="toogle_[% shop_part.id %]" style="background-image:url(image/gruener_punkt.gif);background-repeat:no-repeat;witdh:15px;height:15px;" onclick="kivi.shop_part.part_toggle_active([% shop_part.id %] ,[% shop_part.active %]);" onMouseOver="this.style.cursor='pointer'">&nbsp; </div>
<div id="toogle_[% shop_part.id %]" style="background-image:url(image/gruener_punkt.gif);background-repeat:no-repeat;witdh:15px;height:15px;" onclick="kivi.ShopPart.part_toggle_active([% shop_part.id %] ,[% shop_part.active %]);" onMouseOver="this.style.cursor='pointer'">&nbsp; </div>
[% ELSE %]
<div id="toogle_[% shop_part.id %]" style="background-image:url(image/roter_punkt.gif);background-repeat:no-repeat;witdh:15px;height:15px;" onclick="kivi.shop_part.part_toggle_active([% shop_part.id %] ,[% shop_part.active %]);" onMouseOver="this.style.cursor='pointer'">&nbsp; </div>
<div id="toogle_[% shop_part.id %]" style="background-image:url(image/roter_punkt.gif);background-repeat:no-repeat;witdh:15px;height:15px;" onclick="kivi.ShopPart.part_toggle_active([% shop_part.id %] ,[% shop_part.active %]);" onMouseOver="this.style.cursor='pointer'">&nbsp; </div>
[% END %]
</td>
<td>[% L.html_tag('span',LxERP.t8(), id => 'active_price_source_' _ shop_part.id) %] </td>
......
</td>
<script type="text/javascript">
$(function() {
kivi.shop_part.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
kivi.shop_part.update_stock([% shop_part.id %]);
kivi.ShopPart.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]');
kivi.ShopPart.update_stock([% shop_part.id %]);
});
</script>
</tr>
......
[% L.radio_button_tag('upload_todo', value='price', label= LxERP.t8('Only Price')) %]
[% L.radio_button_tag('upload_todo', value='stock', label= LxERP.t8('Only Stock')) %]
[% L.radio_button_tag('upload_todo', value='price_stock', checked=1, label= LxERP.t8('Price and Stock')) %]
[% L.button_tag("kivi.shop_part.setup();", LxERP.t8("Upload all marked"), id="mass_transfer") %]
[% L.button_tag("kivi.ShopPart.setup();", LxERP.t8("Upload all marked"), id="mass_transfer") %]
</div>
<div id="status_mass_upload" style="display: none;">
[%- INCLUDE 'shop_part/_upload_status.html' %]
templates/webpages/shop_part/_list_images.html
[% L.sortable_element('#images_list tbody', url=SELF.url_for(action='reorder'), with='image_id') %]
<p>
[% L.button_tag("kivi.shop_part.imageUpload(" _ FORM.id _ ",'shop_image','image','Upload shopimage',0);", LxERP.t8('Upload shopimage') ) %]
[% L.button_tag("kivi.ShopPart.imageUpload(" _ FORM.id _ ",'shop_image','image','Upload shopimage',0);", LxERP.t8('Upload shopimage') ) %]
</p>
templates/webpages/shop_part/categories.html
[% END %]
[% END %]
</div>
[% L.button_tag("kivi.shop_part.save_categories(" _ SELF.shop_part.id _", " _ SELF.shop_part.shop.id _")", LxERP.t8("Save")) %]</td>
[% L.button_tag("kivi.ShopPart.save_categories(" _ SELF.shop_part.id _", " _ SELF.shop_part.shop.id _")", LxERP.t8("Save")) %]</td>
</form>
templates/webpages/shop_part/edit.html
[% # L.dump(SELF.shop_part) %]
[% IF SELF.shop_part.id %]
[% L.button_tag("kivi.shop_part.save_shop_part(" _ SELF.shop_part.id _ ")", LxERP.t8("Save")) %]</td>
[% L.button_tag("kivi.ShopPart.save_shop_part(" _ SELF.shop_part.id _ ")", LxERP.t8("Save")) %]</td>
[% ELSE %]
[% L.button_tag("kivi.shop_part.add_shop_part(" _ FORM.part_id _", " _ FORM.shop_id _")", LxERP.t8("Save")) %]</td>
[% L.button_tag("kivi.ShopPart.add_shop_part(" _ FORM.part_id _", " _ FORM.shop_id _")", LxERP.t8("Save")) %]</td>
[% END %]
[% # L.button_tag("kivi.shop_part.update_partnumber()", LxERP.t8("Update Partnumber")) %]</td>
[% # L.button_tag("kivi.ShopPart.update_partnumber()", LxERP.t8("Update Partnumber")) %]</td>
[% # L.hidden_tag("action", "ShopPart/dispatch") %]
[% # L.submit_tag('action_update', LxERP.t8('Save')) %]

Auch abrufbar als: Unified diff